Recipe: Converting XML into Trees
While many web services have moved to the simpler JSON format, XML is still a popular and powerful document encoding. iOS’s
NSXMLParser class scans through XML, creating callbacks as new elements are processed and finished (that is, using the typical logic of a SAX parser). This class is terrific for when you’re downloading simple data feeds and want to scrape just a bit or two of relevant information. It might not be so great when you’re doing production-type work that relies on error checking, status information, and back-and-forth handshaking.