JDOM is
open source. It is a Java API that is purely written in Java for Java.
With this API in place you can easily work with your XML documents.
You can parse them, create them, manipulate them and serialize them
the way you want.
_______________________________________________
_______________________________________________
In
one way you can compare the JDOM with the DOM model. In both these models
the XML document is represented as a tree structure of elements, attributes,
etc.
The Java
coding conventions were followed in developing the JDOM. All the methods
like, equals(), hashCode(), and toString() are also available in JDOM.
The java.util.List is the place where all the elements and their children
are stored.
While writing
the code to create an element in an XML file, it is straightforward
and easy to create it in JDOM. Whereas in the DOM model using the JAXP,
you have to create the document object in three steps and then only
you can add an element to that object. In JDOM if you want to create
a new document object, it is very straight forward and you can write
the code as,
Document
doc = new Document();
Suppose
you want to create a new element 'person' and add a text 'Bill' to it,
then you can easily write the code as,
Element
root = new Element("person");
root.setText("Bill");
After creating
the element you can easily add it to the document object with the code,
doc.setRootElement(root);
It is so
easy to work with JDOM. There are lots of examples and tutorials on
using JDOM for manipulating XML documents.