I. Basic concepts of analysis
Extracting data from pre-defined formats
The premise of parsing: to agree a good format in advance. Data providers provide data in a format that data is retrieved in the form of data
XML parsing JSON parsing of common parsing methods
Two. XML: Extensible Markup Language
XML data Format functionality: Data Exchange Web Service Content management as a configuration file
A pair of tags called a node node can contain nodes that have no child nodes called leaf nodes only one root node node can be nested with each other
Three. Sax tools to use when parsing xml
The Sax:simple API for XML parses data row by line based on an event-driven parsing method. (with protocol callback mechanism)
Nsxmlparser class
Nsxmlparser is an XML parsing class that comes with iOS, parsing data using sax
The parsing process is callback by the Nsxmlparserdelegate protocol method
Parsing process: Start label, end tag, start tag, value-
Four. Using the DOM tool for XML parsing
DOM parsing: Document Object Model parsing requires the XML file to be read into the whole, and the XML is structured into tree-like use and then read the relevant data through the tree structure
Parse the data in a stack
Gdataxmlnode is the open source XML parsing class provided by Google, and the libxml2.dylib is objective-c encapsulated
Parsing data using Dom method
iOS contains a C language dynamic link library libxml2.dylib, resolution faster than Nsxmlparser