Json
JSON (JavaScript Object Notation) is a lightweight data interchange format with good readability and easy-to-write features. Data exchange between different platforms is possible. JSON uses a very high compatibility, completely independent of the language text format, but also has a similar to the C language habits (including C, C + +, C #, Java, JavaScript, Perl, Python, etc.) the behavior of the system. These features make JSON an ideal data exchange language.
Xml
The Extensible Markup Language (extensible Markup Language, XML), which is used to tag electronic files with a structured markup language that can be used to tag data, define data types, is a source language that allows users to define their own markup language. XML uses a DTD (document type definition) to organize data into a single, unified format, cross-platform and language, and has long been recognized as a standard in the industry.
JSON (data relative to XML, lightweight, high transfer rate, less redundant data.) Cons: Poor readability)
XML (more redundant data, advantages: Strong readability, strong extensibility)
The/*xml Extensible Markup Language, which is used primarily for client-to-server data interaction.
*xml Data features: A top-down tree structure with only one root node:<root>...</root>
* The process of parsing XML data is the process of acquiring node content
*xml and json:xml data are readable and extensible, but data with no JSON format is lightweight and redundant data is more
*/
Nsjsons .....
Sbjson
1. System Nsxmlparser more complex
2. Third party open Source Library GData Common Kissxml
Parsing XML frequently used libraries: GData
The bottom layer uses the LIBXML2 Library of the system, adding LIBXML2 when used
(1) Import Gdata Library and drag it directly in
(2) Set header file search path
Build Setting--->header search Path
Add/USR/INCLUDE/LIBXML2
(3) Add libxml Binary Library
Build Phases---> Link Binary
Add Libxml2.dylib
(4) If it is an arc project
Build Phases---> Compile Source File
GDATAXMLNODE.M (non-ARC)
GData third-party libraries have two ways of parsing
1. Get root node all elements traverse all child nodes
2.xpath syntax
Common methods of Json&&xml and XML parsing