In the last post we saw how to call REST and SOAP web services. The web service reponse can be one of the following:
- XML.
- SOAP.
- JSON.
Parsing XML
Android offers three types of XML parsers:
- DOM Parser.
- Pull Parser.
- SAX Parser.
we’ll demonstrate each using the following xml example:
<?xml version="1.0"?>
<person>
<firstname>Jack</firstname>
<lastname>smith</lastname>
<age>28</age>
</person>
which we need to parse to create an object from Person class:
public class Person{
public String firstName;
public String lastName;
public int age;
}
