I need to write and update XML file based on nodes.
For that I found that I need to convert local XML file into plist file.
Then I can able to update, read and write into plist file as we need.
But I didn’t found any sample code regarding this.
Can anyone please post some code regarding how can I save local xml file into plist file?
How can I read, write and update that locally saved plist file?
You first need to parse the XML file into
NSDictionaryandNSArrayandNSStringobjects 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
NSDictionarywith keys like this:NSStringwith the name of the elementNSDictionaryof attributesNSStringcontaining the text in the elementNSArrayof sub-elements (array of dictionaries like this one)