Re: Parsing xml files in Cocoa applications
Re: Parsing xml files in Cocoa applications
- Subject: Re: Parsing xml files in Cocoa applications
- From: Devon Ferns <email@hidden>
- Date: Fri, 31 Oct 2008 11:15:17 -0400
NSXMLParser is also good if you don't know or don't care what the order
of the elements are in your XML file.
Devon
Nicko van Someren wrote:
It is worth noting that while the event-driven NSXMLParser class is
available on the iPhone, NXSMLDocument and its friends for the XML DOM
are NOT available on the iPhone. If you have existing code that uses
NSXMLDocument which you want to port to the iPhone you shall need to
rework the code or write classes to emulate the necessary functionality.
Unless you know that you need to keep all the information in your XML
document for use later you can usually save quite a lot of space by
using the event model and being careful which parts of the data you
bother keeping. I suspect that in the memory-constrained world of the
iPhone this was the rationale behind forcing people to use the
event-driven model. You do however need to be cautious when using the
event driven parser in a memory-constrained environment to make sure
that you don't leave lots of objects in the auto-release pool after your
event calls. If you have a large document which you parse and filter
down to some much smaller data set but on the way leave a lot of trash
in the auto-release pool you can find the iPhone app running out of
memory before you've finished parsing the document. If you are unsure
you can always push a local auto-release pool at the start of each of
the event callbacks which do any hard work and pop them again before you
return from the callback.
Cheers,
Nicko
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden