How to parse such kind of Data using NSXML Parsing?
Ho开发者_如何学JAVAw should i parse data which contains CDATA in the Attribute?
Read Event-Driven XML Programming Guide
One way to do it is to use NSXMLParser
to parse the data. Implement NSXMLParserDelegate
's parser:foundCDATA:
to capture the data in the CDATA element.
There are lots of examples of how to use NSXMLParser
.
If you could, I'ld really suggest converting this to JSON-data. The JSON-framework is lots easier to use. Else, I'ld suggest to use the TouchXML-classes (but they're a bit complicated in my opinion because they return elements with attributes instead of plain NSDictionaries and NSArrays).
TouchXML: http://code.google.com/p/touchcode/wiki/TouchXML
JSON-framework: http://code.google.com/p/json-framework/
I suggest to read the following Apple documentation, it should explain that.
http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/NSXML_Concepts/NSXML.html
精彩评论