O'Reilly logo

Xamarin Mobile Development for Android Cookbook by Matthew Leibowitz

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Parsing, processing, and generating XML

Some apps, especially apps used with existing systems, need to be able to parse and generate XML.

Getting ready

For this recipe, we need to have an existing XML file stored in the Assets folder. The structure of the XML file that we will use in this recipe is as follows:

<?xml version="1.0" encoding="UTF-8"?>
<bookshelf>
  <book title="book title">
    <authors>
      <author firstname="name" lastname="surname"/>
      <author ... />
    </authors>
  </book>
  <book>...</book>
</bookshelf>

How to do it...

There are many ways to handle XML, but in this recipe, we will use Language-Integrated Query (LINQ) to XML. One of the most common things to do with XML is to read it, usually from a remote source. Let's take a look at the following ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required