24. Java Operation XML method

Source: Internet
Author: User
XML parsing Method 1. Sax parsing Methods

SAX (simple API for XML) is an alternative to XML parsing. Compared to Dom,sax is a faster and more efficient method. It scans the document row by line, parsing while scanning. And you can stop parsing at any point in the parsing document, compared to Dom,sax. The advantages and disadvantages are:

Pros: Parsing can start immediately, fast, without memory pressure

Cons: Cannot modify the node

2. Dom Parsing method

DOM: (The Document Object model, or the file-objects models) is a way of dealing with XML recommended by the organization. When parsing an XML document, the DOM parser parses all the elements in the document into a Node object (nodes) according to the hierarchical relationships that appear. The advantages and disadvantages are:

Advantage: The XML file is constructed in memory to construct a tree structure that can traverse and modify nodes

Disadvantage: If the file is large, memory pressure, parsing time will be longer

24. Java Operation XML method

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.