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