And look back on the 21st day of Java

Source: Internet
Author: User

The implementation of DOM and sax parsing technology

There are several ways to implement DOM and sax-as-a-system techniques, and here are a few common methods

  • JAXP (Java API for XML:JAXP is an interface that hides a specific parser from an application, providing an abstraction layer mechanism for accessing DOM and SAX implementations
  • Jdom:JDOMis a useXMLthe uniqueJavaToolkit for rapid developmentXMLapplication, which is based on a tree structure, using pureJavaof Technology onXMLparsing, Generation, serialization, and a variety of operations are implemented in the text denier. JDOMDirectly forJavaProgramming services. It uses a more powerfulJavamany features of the language (method overloading, collection concepts, and cherry color), 鼥SAXand theDOMeffective combination of functions, whileJDOMis also usedJavalanguage reading, writing, and OperationXMLthe newAPIfunctions, in a simple and efficient context, theseAPIthe function is optimized to compensate for the maximumDOMandSAXIn the practical application of the shortcomings, inJDOMin whichXMLelement isElementthe instance,XMLproperty isAttributethe instance,XMLThe document itself isElementinstance, so create a newJDOMobjects are like theJavaused inNewoperator is as easy as
  • DOM4J:DOM4J is an easy-to-use, open-source library for XML,XPathand theXslt. It is applied toJavaplatform, using aJavaassemble the framework and fully supportDOM,SAXand theJAXP. In theJavain the development community,dom4jis the most widely used. JDOMoperation is very simple, but in handling largeXML file is poorly performing, parsing10Mdocument, a memory overflow occurs. andDOM4j is a very goodjavaxml API dom4jusing a lot of interfaces, which is also what it is considered more thanJDOMReasons for flexibility

Main interface of DOM4J

Attribute defines the properties of XML

CDATA defines the XML CDATA Region

Characterdata identifies a character-based node. such as CDATA,Comment,Text

Comment Defines the behavior of XML annotations

Document defines XML documents

DocumentType defines the XML DOCTYPE declaration

element defines XML elements

Elementhandler defines the processor for the element object

Node defines the polymorphic behavior for all XML nodes in the dom4j

ProcessingInstruction defines the XML processor directive

Text definition XML text node

XPath provides an XPath expression after parsing a string

And look back on the 21st day of Java

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.