XML and JSON parsing for iOS development

Source: Internet
Author: User

I. xml: an open-source parsing class, gdataxmlnode (add it to the project), and add the libxml2.dylib framework

Frequently used methods:

1.-(ID) initwithxmlstring :( nsstring *) STR options :( unsigned INT) mask error :( nserror *) Error

2.-(ID) initwithdata :( nsdata *) Data options :( unsigned INT) mask error :( nserror *) Error

The two methods can convert the data of the nsstring or nsdata class into XML documents that can be parsed by the gdataxmlnode class.

3.-(gdataxmlelement *) rootelement returns information about all nodes in gdataxmlelement.

4.-(nsarray *) elementsforname :( nsstring *) Name: returns all nodes named name under the current node, and returns an array.

5.-(nsstring *) stringvalue returns the value in the middle of the node.

 

Ii. JSON: sbjson, an open-source framework, is used to extend the nsstring class. All nsstring objects in our program can call the method.

Sbjson method-(ID) jsonvalue this method returns an ID class object, because JSON information is transmitted by key value, so we will use nsdictionary to receive this return value.

 

Two structures:

1. Set of "key-value pairs. Object, record, struct, Dictionary, hashtable, keyed list, and associative array ).

2. ordered list of values. Array ).

Related Article

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.