Chapter 12. XML Processing
In this chapter you 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 12.1 explains the main concepts behind XML and RSS. Section 12.2 presents a detailed discussion of DOM parsing. Section 12.3 offers another, different XML parsing technique, SAX, and shows how you can write a SAX iPhone client. In Section 12.4 we look at a table-based RSS reader application. After that, Section 12.5 presents the final thoughts on this subject. Lastly, Section 12.6 provides a summary of the chapter.
XML and RSS
In this section we discuss XML and then talk about RSS as one of its applications.
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:
its extensibility, which allows anyone to define new XML elements
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:
begin-tag
text content
end-tag.
For example, the element person
can appear in an XML document as:
<person> content ...
Get iPhone SDK 3 Programming: Advanced Mobile Development 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.