Android parsing XML and androidxml

Source: Internet
Author: User

Android parsing XML and androidxml
1. XML: extensible markup language.

Extensible Markup Language is a markup language similar to hypertext markup language.

It is designed to transmit data rather than display data.

Its mark is not predefined. You need to customize the tag.

It is designed to be self-descriptive.

Is the W3C recommendation standard.

2. Three Ways for Android to parse XML

(1). SAX Parsing

Http://www.cnblogs.com/zhangmiao14/p/6183505.html

(2) DOM Parsing

Http://www.cnblogs.com/zhangmiao14/p/6183976.html

(3). Pull Parsing

Http://www.cnblogs.com/zhangmiao14/p/6184201.html

3. Technical Summary

For Android mobile devices, because the device resources are precious and the memory is limited, we need to select the appropriate technology to parse XML, which is conducive to improving the access speed.

(1) when processing XML files, DOM parses the XML files into a tree structure and puts them into the memory for processing. When XML is relatively small, DOM can be selected because it is simple and intuitive.

(2). SAX uses an event as the mode for parsing XML files. It converts XML files into a series of events and is determined by different event processors. When the XML file is large, it is reasonable to select the SAX technology. Although the amount of code is large, it does not need to load all XML files into the memory. This is more effective for limited Android memory, and Android provides a traditional method of using SAX and a convenient SAX package. Using the Android. util. xml class is simpler than using SAX.

(3). XML Pull parsing does not end the listening element like the SAX parsing, but completes most of the processing at the beginning. This helps to read XML files early and greatly reduce the parsing time. This optimization is especially important for mobile devices with slow connection speeds. The XML Pull parser is more effective when the XML document is large but only a part of the document is required.

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.