Resolution: data is stored by background developers according to the agreed format (hypothetical), and data is retrieved by previous developers according to the format.
The essence of resolution: the process of extracting the data we want according to the agreed format
Popular formats: XML and JSON
XML parsing principles:
Sax parsing: A parsing Mechanism Based on Event Callback, that is, using protocols and proxies. Sax Parsing is a line-by-line parsing. When reading data, the system parses one row and one row, therefore, the memory occupied by the sax Parsing is small and suitable for big data parsing.
Dom parsing: read all the content into the memory at a time, read the content into a tree structure, layer-by-layer parsing, suitable for small data parsing.
First method of Dom Parsing
Dom parsing uses gdataxmlnode, an open-source and efficient XML parsing tool provided by Google, which is 10 times faster than nsxmlparser.
Usage: (add the gdataxmlnode. H. M file)
1. Small import system dynamic link library libxml2.2.dylib
2. Add/usr/include/libxml2 to header search path in buildsettings.
3. Add-lxml2 to other linker flags in buildsettings.
The parsing method provided by jsonkit is to add a classification method for nsstring and nsdata. The parsing method is added to the classification method, which is second only to the system's efficiency (using the jsonkit. H. M file)
Parse JSON data into nsarray nsdictionary
The nsarray nsdictionary method is to convert the OC object into a JSON string.
Resolution (with resolution file attached)