Converting incoming XML data into models using XmlReader

Similar to the JsonReader, XmlReader exists for us to work with the XML data efficiently. It provides XPath kind of notation to quickly access the elements of the incoming XML data.

In this recipe, we will see how to work with the XML data and use XmlReader to construct the model, which can be used within the application.

Getting ready

Make sure that you have set up your development environment by following the recipes outlined in Chapter 1.

How to do it...

Carry out the following steps:

  1. Create and open a new file named users.xml and paste the following code into it:
    <?xml version="1.0" encoding="UTF-8"?> <users> <user> <id>1</id> <name>Ajit Kumar</name> <age>33</age> <phone>123-456-7890</phone> ...

Get Sencha Touch Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.