How i can make an xml file from NSString object?
In other words, how can I parse XML from an NSString object?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If this is for the iPhone, you might want to take a look at this question which goes over doing it on the iPhone, using the user defaults method.
For reference, on Mac OS X one could use the
writeToFile:atomically:encoding:error:NSString Method.EDIT: To parse the XML within an NSString, you can use the
NSXMLParserclass. This class does not have a method to initialize it with anNSString, so you have to use itsinitWithData:method like this:And that will initialize it with the
NSString‘s data.Of course, you have to learn how to parse the XML itself using this class. You can take a look at this question for some tips, or you can google around for some tutorials, such as Apple’s very own walkthrough. Here is another walkthrough for using the class.