What is the difference of them? It is said that JAXP is only a API Specification, JDOM and DOM4J realized it, is it right? And all of them need a XML parser, just like XERCES, is it right? thanks in advance!
You're comparing apples and automobiles.
- JAXP is an API that is now bundled with the JDK
- JDOM is a different API, but also a library
DOM4J is also a different API and library
XERCES is a XML parser implemented in Java. A version of XERCES is also bundled in the JDK.
Which API you use is largely a question of personal preference. I like JDOM in part because I'm used to working with it. There are, similarly, several implementations of XML parsers. If you're programming in Java using a recent JDK, you will be able to use JAXP without having to add external libraries.
Is a set of standard APIs for Java XML parsers. It covers the following areas:
- DOM (
org.w3c.dom
package) - SAX (
org.xml.sax
package) - StAX/JSR-173 (
java.xml.stream
) - XSLT (
javax.xml.transform
) - XPath (
javax.xml.xpath
) - Validation (
javax.xml.validation
) - Datatypes (
javax.xml.datatype
)
This standard was created by an expert group with representatives from many companies and individuals. As a standard this means there are multiple implementations (Xerces implements JAXP), and it can be included in the JDK.
Xerces
Is an open source Java XML parser that provides DOM and SAX implementations that are compliant with the JAXP standard.
JDOM and DOM4J
Are open source Java XML parsers.
You're comparing apples and automobiles.
- JAXP is an API that is now bundled with the JDK
- JDOM is a different API, but also a library
DOM4J is also a different API and library
XERCES is a XML parser implemented in Java. A version of XERCES is also bundled in the JDK.
Which API you use is largely a question of personal preference. I like JDOM in part because I'm used to working with it. There are, similarly, several implementations of XML parsers. If you're programming in Java using a recent JDK, you will be able to use JAXP without having to add external libraries.
© 2022 - 2024 — McMap. All rights reserved.