views:

1569

answers:

5

I am a new learner at the area of Objective-C. I would like to retrieve data from XML page on the iPhone. Is it possible? It would be more helpful to me if I get an appropriate suggestion or code.

+2  A: 

The SDK comes with the NSXMLParser class. Some people prefer to use the libxml2 library as it can be faster and more memory efficient than NSXMLDocument but you may want to wrap it with an Objective C layer as it is a C API. See this example.

Tony Lambert
No NSXMLDocument in the iphone sdk, it only has NSXMLParser.
Ryan Townshend
A: 

There is also some other libraries: TouchXML, KissXML.

Quentin
+1  A: 

A good article that lays out how you can use NSXMLParser to rip through xml.

Parsing XML in Cocoa

Ryan Townshend
+2  A: 

There was a good episode of cocoaFusion: the other day that covered the ins and outs of XML parsing. Head on over to cocoafusion.net and look for Episode 2: An intro to using web APIs and XML.

The show notes section for that episode has some sample code downloads and links to other sites that contain more information (including some of the links mentioned in the other answers here).

Cheers!

Michael Fey
A: 

Check out the SiesmicXML tute on Apple's iPhone developer site. It uses the XMLParser in a dedicated thread to parse XML in a backgroud process.

JK

Alpinista