Reputation: 2617
I want to save user generated data in an XML file in the iphone. While we have NSXMLParser to parse through any xml from a url, do we have any method to create a xml file which can be stored in the app documents directory, so that i can use the parser to read the file and then display the contents back in the app.
Or using Core Data is the last resort?
Upvotes: 1
Views: 2712
Reputation: 1297
Look into NSCoder & NSKeyedArchiver. for example with NSDictionary, you can do:
- (BOOL)writeToFile:(NSString *)path atomically:(BOOL)flag
it'll write out the data as a plist. plists are in XML format.
Upvotes: 1
Reputation: 96927
Look into libxml2
and, specifically, xmlTextWriter
. Lots of examples available through Google.
Upvotes: 1