Is there a simple way of parsing XML within iPhone app's?
I have been using NSXMLParser and I have heard of libxml2 - I am correct in stating that these are my only two options.
I just don't want to go down a long road when there is something simply that I can use.
There is also TouchXML which is nice and straight forward.
This blogpost gives a great overview of the most common XML parser available for iPhone (build - in and 3rd - party)
Related
Is it possible to get information from a url?
For example, it would be possible to get the headline and the image through the following url:
http://www.farodevigo.es/deportes/2011/08/24/lopez-garai-herrera-equivoca-prescindiendo/574038.html
Try this - What's the best approach for parsing XML/'screen scraping' in iOS? UIWebview or NSXMLParser?
also http://cocoawithlove.com/2008/10/using-libxml2-for-parsing-and-xpath.html
Yes, that is possible but I wouldn't reccommend it.
In general, parsing HTML is hard - it's probably badly formatted and you would have a hassle trying to work out which bits you wanted and which bits you didn't.
You are better off using this URL : http://www.farodevigo.es/elementosInt/rss/1 and using NSXMLParser - because it's RSS it's definitely going to be well formed and easy for you to understand :)
I have some XML which I need parsed in my Objective-C code. The XML is fairly simple. I have already searched Stackoverflow as well as Google but I did not find what I am looking for. Examples if how to use NSXMLParser would be useful, and if anyone has any suggestions on how to do this another way please let me know.
Did you look at the Apple sample applications? From the NSXMLParser class reference, I found no fewer than five sample projects that did parsing.
GKTank
KMLViewer
LazyTableImages
SeismicXML (probably your best bet, and most directly related)
XMLPerformance
I recommend going through this tutorial by Ray Wenderlich:
http://www.raywenderlich.com/725/how-to-read-and-write-xml-documents-with-gdataxml
It uses GDataXML, which from my experience is a light-weight easy to use XML parser. It goes through all the basic steps to read and write to an XML document in a specific directory, including making or ammending to the file if it doesnt exist or exists respectively.
Hey I would like to build an app that could parse a website in order to get specific information. Specifically something that can parse http://www.fedex.com/Tracking?language=english&cntry_code=us&tracknumbers=681780934297262 for the important information. Is there a tutorial out there I could use.
This Cocoa With Love article discusses parsing XML and HTML with the libxml2 library that is available with Xcode, using XPath to pull out the node(s) of interest. Take a look at the PerformHTMLXPathQuery() function.
Try this tool: http://code.google.com/p/sitescraper/
I need a powerful HTML parser and manipulator for Objective-C/C, like HTML Agility Pack.
Can anyone tell me some optimal solution? One solution is libxml2, but it seams is not the best.
Thanks in advance!
On MacOS X, NSXMLDocument is a good solution (but you want iPhone).
Two packages that you should look at are: TouchXML and KissXML.
See also iPhone Development - XMLParser vs. libxml2 vs. TouchXML.
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.
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.
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!
A good article that lays out how you can use NSXMLParser to rip through xml.
Parsing XML in Cocoa
There is also some other libraries: TouchXML, KissXML.
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