How to save locally saved xml file into .plist file How to save locally saved xml file into .plist file xml xml

How to save locally saved xml file into .plist file


You first need to parse the XML file into NSDictionary and NSArray and NSString objects and then you can save it with -[NSDictionary/NSArray writeToURL:atomically:].

There are various tutorials available on how to parse XML. I recommend TBXML as it's extremely fast.

You would parse the XML file and put the data into an NSDictionary with keys like this:

  • Name: NSString with the name of the element
  • Attributes: NSDictionary of attributes
  • Text: NSString containing the text in the element
  • Sub-elements: NSArray of sub-elements (array of dictionaries like this one)