Clone this wiki locally

JDOM2 Features

Apart from the details described below, it is important not to forget that JDOM2 is delivered with a completely different package name: - all JDOM2 classes are now in the org.jdom2.* package hierarchy.

This change is guaranteed to break all compatibility with JDOM1. The decision was made to do it this way so that:

changes to the API are possible

JDOM users will need to re-visit their code to change the import statements (at least) and at that time they can take advantage of other JDOM2 features

it is possible to simultaneously run both JDOM and JDOM2 in the same Java VM if necessary.

In addition to the major extensions and features above a number of other notable changes have been made too.

Serialization

Serialization has been completely audited, revamped, and tested. All core JDOM content is completely serializable. This includes: Namespace, Attribute, all Parent, and all Content.

Clone

Clonable has been completely audited, revamped, and tested. All core JDOM content is completely cloneable. This includes: Attribute, all Parent, and all Content. Namespace is not Clonable. In addition, the clone() method has been made to have a covariant return type for each of these classes, thus Element.clone() returns Element, Text.clone() returns Text, etc.

Cloning JDOM content will always result in a 'deep' clone, and the cloned content will always be detached. You cannot change any infomation related to the original content by changing the clone, and visa-versa.