This question can be very simple but could not find the answer; I receive an XML from web servi开发者_StackOverflowce, I want to simply edit some nodes on it and send it back again, and I want to do this without writing the XML to disc, or converting whole XML into model objects and construct back again to an XML file. Just simply quickly edit XML on the run and send it back.
I can do this getting XML as a string from NSData and manipulate the string and then convert back NSData from that string again. But I don't think it is safe working on strings. I use GData XML as a parser but I guess the idea should be similar with other DOM parsers too.
p.s if you really think manipulating it as an NSString is harmless this can also be a solution
I would prefer using NSMutableDictonary
to manipulate partial data, as it allows you to access the data quickly by the key without need to parse the NSString
.
I have done similar edits converting from NSData and manipulating NSString and have not had any problems. Try that approach before you resort to something more complex.
精彩评论