What's the difference of JAXP, JDOM, DOM4J,and XERCES?

11,568

Solution 1

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.

Solution 2

JAXP (JSR-206)

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.

Share:
11,568
Y.L.
Author by

Y.L.

software engineer

Updated on August 04, 2022

Comments

  • Y.L.
    Y.L. almost 2 years

    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!