XML parsing operations in "Java parsing xml" "Two" JDK __java

Source: Internet
Author: User

JAVA parsing XML is usually in two ways, DOM and SAX. Although DOM is the standard of the consortium, provides a standard parsing method, but its parsing efficiency has been unsatisfactory, because when parsing XML using the DOM, the parser reads the entire document and constructs a tree structure (the node tree) that resides in memory, and then your code can manipulate the tree structure using the standard interface of the DOM. But most of the time we're only interested in part of the document, and it's very time-consuming to index some of the data we need from the root node of the node tree without parsing the entire document first.

Sax is an alternative method of XML parsing. Compared to the Document Object Model Dom,sax is a faster, lighter volume of reading and manipulating XML data
Method. SAX allows you to process a document when it is read, so that you do not have to wait for the entire document to be stored before taking action. It does not involve the overhead and conceptual jumps necessary for DOM. The SAX API is an event-based API that works with data flow, which processes data sequentially as data flows. The SAX API notifies you when a certain event occurs while parsing your document. When you respond to it, the data that you do not save will be discarded.


Sax parsing in the first part of JDK


Pending Update---------------

Network resources: http://www.iteye.com/topic/763895



Stax analysis in the second part of JDK


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.