Four ways to "reprint and organize" Java to parse or generate XML

Source: Internet
Author: User

Reference articles

1:http://blog.csdn.net/clemontine/article/details/53011362

2:http://www.jb51.net/article/98456.htm

http://blog.csdn.net/javawebrookie/article/details/49560643

Parsing XML in 1.DOM mode
Dom parsing is an XML file loaded into memory, assembled into a DOM tree, and then through the relationship between nodes and nodes to parse the XML file, and platform-Independent, Java provides a basic parsing XML file API, understanding is relatively simple

Advantages

① allows applications to make changes to data and structures.

② access is bidirectional and can be navigated up and down in the tree at any time, capturing and manipulating any part of the data.

Disadvantages

① usually needs to load the entire XML document to construct the hierarchy, consuming resources.



Parsing XML in 2.SAX mode
Event-driven, one-by-one parsing, for parsing XML data only, hard to encode, and difficult to access multiple different data in the same document at the same time

Parsing XML in 3.JDOM mode
Simplifies interaction with XML and is faster than using the DOM, simplifies APIs by using only specific classes instead of interfaces, and is easy to use

Parsing XML in 4.dom4j way
Jdom is a kind of intelligent branch, the function is strong, suggest skilled use

Four ways to "reprint and organize" Java to parse or generate XML

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.