Java Document Object Model (JDOM) is a Java programmable interface(Application Programming Interface, API) for handling XML documents. JDOM is also implemented in Java and is available as open source software at the link below. JDOM was developed specifically for Java, and is thus in contrast to the platform-independent interfaces Document Object Model (DOM) and Simple API for XML (SAX).
However, JDOM offers better performance as well as better memory usage than the original Document Object Model (DOM). JDOM is not a wrapper for the Document Object Model (DOM) specified by the World Wide Web Consortium (W3C). JDOM is rather a self-sufficient class library that maps a separate class with the corresponding methods for each XML node of the node tree. An alternative to JDOM is dom4j - an API that is also available as open source and offers a wide range of functions. JDOM is based on an initiative by Jason Hunter and Brett Laughlin, so JDOM is neither a specified standard of the W3C nor part of the Java Development Kit (JDK). The developers of Java - the company Sun - offers with JAXP its own Java interface to XML.
JDOM as an Open Source APIJDOM is an open source API for the performant reading, writing as well as the modification of XML documents. For the construction of JDOM models, JDOM does not implement its own parser, but uses an external parser to read the XML document. Compared to the Java package for the DOM (Document Object Model) provided by the W3C, JDOM does not use a node object, and thus the tree to be built from an XML document for its processing is not mapped as an ordered set of XML nodes. JDOM fully supports the mechanisms known from Java, such as inheritance and method overloading, and also makes intensive use of Java's so-called Collection API, which works with containers for objects.
The JDOM package available at the link below includes:
While the input package supports both a DOM and a SAX parser, the output package consists of so-called helper classes for transforming JDOM documents into another representation of an XML document. For example, a JDOM document can be transformed into a DOM document. The adapters package supports already existing implementations, e.g. adapter classes for Sun JAXP, Oracle, Apache Xerces or Apache Crimson parsers. You can also define your own adapter classes. The filter package organizes the visibility of all JDOM objects in a tree and the selection of element objects. The transform package realizes wrappers for Sun's own JAXP. And finally, the xpath package provides the possibility to make requests to an object tree in JDOM using the XPath language. Methods known from DOM like getElementById() can be implemented in their own version.
JDOM implementations for XML documents
The JDOM implementation faces standardized interfaces like DOM and SAX for processing XML documents. On the other hand, dom4j and JAXP offer possibilities - also on the Java level - for the efficient handling of XML documents. JAXP in particular assigns the wide range of technologies such as DOM, SAX, SAX, XLST and XPath to an overlying abstraction layer with convenient Java interfaces. This also avoids the disadvantage of using external parsers directly and the dependency on specific classes that can be derived from this. Ultimately, however, criteria such as the size, source and structure of the XML documents as well as their frequency and scope of processing will be decisive for the use of a particular interface or tool.