What is the difference in JAXP, JDOM, DOM4J and XERCES?

What is their difference? They say that JAXP is just an API specification, JDOM and DOM4J understood this, right? And they all need an XML parser, like XERCES, right? thanks in advance!

+6
source share
2 answers

You compare apples and cars.

  • JAXP is an API that is now associated with the JDK
  • JDOM is a different API, but also a library
  • DOM4J is also another API and library

  • XERCES is an XML parser implemented in Java. The XERCES version also comes in the JDK.

Which API you use is largely dependent on personal preferences. I like JDOM partly because I'm used to working with it. Similarly, there are several implementations of XML parsers. If you program in Java using the recent JDK, you can use JAXP without the need to add external libraries.

+7
source

JAXP (JSR-206)

It 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 a group of experts with representatives of many companies and individuals. As a standard, this means that there are many implementations (Xerces implements JAXP), and it can be included in the JDK.

Xerces

It is an open source Java XML parser that provides DOM and SAX implementations that conform to the JAXP standard.

JDOM and DOM4J

They are open source Java XML parsers.

+11
source

Source: https://habr.com/ru/post/925681/


All Articles