What is JDOM
JDOM is an in-memory XML model that can be used to read, write, create and modify XML Documents. JDOM is similar to DOM in that they both provide an in-memory XML document model, but while DOM is designed to work the same in multiple languages (C, C++, ECMAScript, Java, JScript, Lingo, PHP, PLSQL, and Python [http://www.w3.org/DOM/Bindings]), JDOM is designed only for Java and uses the natural Java-specific features that the DOM model avoids. For this reason JDOM intentionally does not follow the w3c DOM standard. JDOM is not an XML parser but it can use a SAX, StAX or DOM parser to build the JDOM document. JDOM versions since JDOM 2.0.0 (JDOM2) all use the native language features of Java6 and later like Generics, Enums, var-args, co-variant return types, etc.
In the tutorials listed below we provide you with examples of all key functionalities of JDOM2. However before you start seeing the examples, it would be a good idea to understand the main packages that form part of JDOM2 and the functionalities that each of the packages provide. The first tutorial in the series provides an introduction to the package structure along with important classes in each package. The subsequent tutorials provide examples for each of the key functionalities.
- JDOM2 package structure – Introduces the package structure and explains the important classes that form the API
- JDOM2 Usage – An introduction to building and using JDOM2 Document.
- SAXBuilder Example
- SAXBuilder with DTD validation
- SAXBuilder with XSD validating – This tutorial explains how create a JDOM2 from an XML using a SAX parser by validating the document using an XSD. The example explains how to validate using an internal XSD as well as an external XSD
- SAXBuilder – A discussion on various components of SAXBuilder and ways to configure it
- DOMBuilder – A tutorial on building a JDOM2 document from a w3c Document using DOMBuilder.
- Building JDOM2 using StAX
- Outputter – In this tutorial we learn how to output JDOM2 as XML, DOM, SAX, StAXEvent and StaxStream
- Transforming the JDOM2 document using XSL
- Querying a JDOM2 document using Xpath
– We thank
for reviewing the tutorials and giving us a detailed feedback on the pages.
If you like the tutorial then please put in your comments and also ‘like’ us on facebook or follow us on google.
1 thought on “Java XML – JDOM2 – Introduction”
Great tutorialThank you.