Top Description Interfaces Classes Enums
[default module]

Package org.jdom2


Classes representing the components of an XML document.

In addition there are the Exceptions related to JDOM processing and some classes useful for creating and accessing JDOM Content.

Core JDOM classes

All XML in JDOM is represented in the following classes: In addition to these 8 classes there are also the Attribute and Namespace classes which are used to represent these respective XML structures in Element. In the DOM model the 'Attr' (attribute) class is considered to be a DOM 'Node'. In JDOM this is not the case - Attribute is not Content.

The XML Structure is embodied in the the concept of Parent JDOM classes and regular JDOM Content. Parent is an interface, and Content is an abstract class. The Document and Element classes are both Parent classes, Text, CDATA, Comment, EntityRef, ProcessingInstruction, DocType and Element are all Content. Note that Element is both Parent and Content.

To enforce XML well-formedness, Document is only allowed a restricted set of child content: any number of ProcessingInstructions and Comments, one DocType, and one Element (the 'root' element). Element is allowed any child content except DocType.

The NamespaceAware interface identifies those JDOM constructs which are sensitive to Namespaces, which is all 8 core types and also Attribute. In JDOM NamespaceAware classes are able to identify and report the Namespace Context in which they exist.

JDOM helper classes

The Verifier is a special class useful in ensuring well-formedness of documents. It contains all the rules for ensuring the JDOM model always has well-formed content.

JDOMConstants interface contains a number of constant values that JDOM users may find useful when creating or manipulating JDOM structures. These are in addition to (but some may duplicate) the constants found in the javax.xml.XMLConstants class.

The JDOMFactory interface is primarily used when building JDOM documents from some source (SAX, DOM, etc.) using one of the input Builders (SAXBuilder, DOMBuilder, etc.). The default JDOMFactory is the DefaultJDOMFactory). If you have custom JDOM classes or want special treatment for content as it is being created you can supply you own JDOMFactory instance to the input Builder. Typically you would extend the DefaultJDOMFactory for this purpose. The DefaultJDOMFactory ensures all XML rules are followed correctly. The UncheckedJDOMFactory may create JDOM content that does not follow XML well-formedness rules. Use the UncheckedJDOMFactory in places where you are certain the input is correct (perhaps the results of a document parsed by a trusted third-party parser). The UncheckedJDOMParser is only marginally faster than the DefaultJDOMParser.

Interface Summary

Modifier and TypeInterface and Description
public interface
JDOMFactory

An interface to be used by builders when constructing JDOM objects.

public interface
NamespaceAware

Classes implementing this interface are all sensitive to their Namespace context.

public interface
Parent

Interface for JDOM objects which are allowed to contain Content content - Element and Document.

Class Summary

Modifier and TypeClass and Description
public class
Attribute

An XML attribute.

pack-priv class
AttributeList

AttributeList represents legal JDOM Attribute content.

public class
CDATA

An XML CDATA section.

pack-priv class
CloneBase

This simple class just tidies up any cloneable classes.

public class
Comment

An XML comment.

public abstract class
Content

Superclass for JDOM objects which can be legal child content of org.jdom2.Parent nodes.

pack-priv class
ContentList

A non-public list implementation holding only legal JDOM content, including content for Document or Element nodes.

public class
DataConversionException

Thrown when a data conversion from a string to value type fails, such as can happen with the Attribute convenience getter functions.

public class
DefaultJDOMFactory

Creates the standard top-level JDOM classes (Element, Document, Comment, etc).

pack-priv class
DescendantIterator

Traverse all a parent's descendants (all children at any level below the parent - excludes the parent itself).

public class
DocType

An XML DOCTYPE declaration.

public class
Document

An XML document.

public class
Element

An XML element.

public class
EntityRef

An XML entity reference.

pack-priv class
FilterIterator<
The Generic type of content returned by this FilterIterator.
T
>

Traverse a parent's children that match the supplied filter.

public class
IllegalAddException

Thrown when trying to add an illegal object to a JDOM construct.

public class
IllegalDataException

Thrown when illegal text is supplied to a JDOM construct.

public class
IllegalNameException

Thrown when a name is supplied in construction of a JDOM construct whose where the name breaks XML naming conventions.

public class
IllegalTargetException

Thrown when a target is supplied in construction of a JDOM ProcessingInstruction, and that name breaks XML naming conventions.

public class
JDOMConstants

A collection of constants that may be useful to JDOM users.

public class
JDOMException

The top level 'checked' exception that JDOM classes can throw.

public class
Namespace

An XML namespace representation, as well as a factory for creating XML namespace objects.

public class
ProcessingInstruction

An XML processing instruction.

public class
SlimJDOMFactory

This JDOMFactory instance reduces the amount of memory used by JDOM content.

pack-priv class
StringBin

This is a mechanism for storing and reusing unique instances of Strings.

public class
Text

An XML character sequence.

public class
UncheckedJDOMFactory

Special factory for building documents without any content or structure checking.

public class
Verifier

A utility class to handle well-formedness checks on names, data, and other verification tasks for JDOM.

Enum Summary

Modifier and TypeEnum and Description
public enum
AttributeType

Use a simple enumeration for the Attribute Types