Working With XML
In This Chapter
Seeing how the XML parser works
Using the XML parser delegates
Processing the XML response
The state of play at the end of Chapter 7 had the Empire State Building floating in the mid-Atlantic. This of course will never do, especially if you’re in New York and want to visit it. In this chapter, I show you how to take the XML data returned from the Geocoding web service request and use the XML parser that’s part of the SDK to extract the data you need to place it where it really belongs on the map.
Parsing the XML Response
The whole point of using the Geocoding web service in RoadTrip is to be able to quickly get accurate (and usable) location information whenever you request it. You send the request in the form of an address or point of interest. What you get back from the request is a response, which is a lot of data in XML format. For you to be able to use the data you get back, you are going to have to parse the XML response to extract the data (latitude and longitude) you are interested in.
The key factor here is the XML parser — being able to download XML from a web service is pointless unless you can access the data within it.