I’m building an iPhone app that is essentially a book, it will be bundled with a lot of text-heavy content.
I considered bundling the data as XML and load it when the application starts but the XML would contain a lot of nested structures and be a bit of a pain to parse.
Would it be better to use a plist? I’m concerned about memory usage and plists are loaded entirely into memory – can they be parsed in chunks? Is there a maximum size to a plist and how efficient are they?
I’m not sure how big the bundled content is going to be yet but I should imagine it could be anywhere from 500k to 4MB.
Property Lists are the native serialization format for anything derived from NSObject. There are some issues with mutable-state preservation, but overall plist is the format preferred by Apple.There are parsing methods available with NSData that abstract away the details of the mark-up. As for XML, you’re burdened with the task of writing your own parser.
You can refer to this for further details.
It should be noted that a plist file itself is strict XML; in choosing plist, on the server-side you should be able to parse the plist XML and treat every two nodes as key-value pairs.