Chapter 8

Working With XML

In This Chapter

arrow Seeing how the XML parser works

arrow Using the XML parser delegates

arrow 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.

To ...

Get iOS Cloud Development For Dummies now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.