Reputation: 37136
I just implemented my first XmlParser
object (MyParserObj
) that relies on the NSXMLParser object.
This parser is embedded inside a tableviewController
(MyTableViewController
) and it starts parsing at MyTableViewController
's viewDidLoad
method.
Ok.This is working just fine.It's a small Xml file though! I was wondering if I should choose a different approach when dealing with big Xml files? Will memory suffer when parsing large xml documents?
UPDATE
The real point I want to understand is the flow of the process:
I placed few breakpoints now and it looks like this:
Apart from choosing a XmlParser (Between those you suggested) that is more or less time/memory consuming are the above steps going to be the same?
If positive, is it correct to think of starting populating the cells as soon as The Parser is done with that specific element?How do I do that?
thanks
Luca
Upvotes: 0
Views: 795
Reputation: 69469
Jim Dovey create a nice blog post about parsing big XML files.
http://blog.alanquatermain.me/2009/04/06/aqxmlparser-equals-equals-big-memory-win/ here Jim describes his one XML parser wich user les memory then other parser.
So if you need to parse large XML files I would suggest you have a look het the open source XML parser AQXMLParser which is the parser create in the blog post.
Upvotes: 3
Reputation: 947
On iPhone devices, you don't have the NSXMLDocument available on MAC which reads the whole XML document into memory. There are many XML Parser classes available, and you can find them in the link below.
http://www.raywenderlich.com/553/how-to-chose-the-best-xml-parser-for-your-iphone-project
This tutorial on Ray Wenderlich is what u need to read to know which xml reader is best for your app.
For my own applications, I use SMXMLDocument, you can read about it here: http://nfarina.com/post/2843708636/a-lightweight-xml-parser-for-ios
Upvotes: 2
Reputation: 8947
for big data, i suggest u json instead of xml, see here a tutorial
http://www.readwriteweb.com/hack/2010/11/json-vs-xml.php
Upvotes: 0