UI Learning Note---16th Day XML JSON parsing

Source: Internet
Author: User

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

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.