Chapter 11. XML Processing

In this chapter, you will learn how to effectively use XML in your iPhone application. The chapter follows the same theme used in others chapters and exposes the main concepts through a working iPhone application: an RSS feed reader.

The chapter is organized as follows. Section 11.1 explains the main concepts behind XML and RSS. Section 11.2 presents a detailed discussion of DOM parsing. Section 11.3 offers another, different XML parsing technique, SAX, and shows how you can write a SAX iPhone client. In Section 11.4 we look at a table-based RSS reader application. Finally, Section 11.5 provides a summary of the main steps you need to take in order to effectively harness the power of XML from within your native iPhone application.

XML and RSS

XML

Extensible Markup Language (XML) is a meta-language specification for exchanging information over the internet. As a meta-language, it can be used to define application-specific languages which are then used to instantiate XML documents that adhere to the semantics of these languages.

The power behind XML is due to: (1) its extensibility, which allows anyone to define new XML elements, and (2) it being based on text, thus opening your application data to being used on any computing system.

To create/use an XML language, you need to identify the elements used in that language. An XML element uses: (1) a begin-tag, (2) text content, and (3) an end-tag. For example, the element person can appear in an XML document as: ...

Get iPhone SDK Programming: Developing Mobile Applications for Apple iPhone and iPod touch 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.