Graphics Programs Reference
In-Depth Information
Parsing XML with NSXMLParser
To parse the XML, you will use the class
NSXMLParser
. An
NSXMLParser
instance
takes a chunk of XML data and reads it line by line. As it finds interesting information, it
sends messages to its delegate, like, “I found a new element tag,” or “I found a string in-
side of an element.” The delegate object is responsible for interpreting what these mes-
sages mean in the context of the application.
In
ListViewController.m
, delete the code you wrote in
connectionDidFin-
ishLoading:
to log the XML. Replace it with code to kick off the parsing and set the
parser's delegate to point at the instance of
ListViewController
.
- (void)connectionDidFinishLoading:(NSURLConnection *)conn