Common methods of Json&&xml and XML parsing

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.