Summary

JDOM models an XML document as a Document object that contains a List of Comment and ProcessingInstruction objects and a single Element object for the root element.

Each Element object contains a List of its children: Comment, ProcessingInstruction, Text, and other Element objects. In addition, it has separate lists of attributes and additional namespaces. The list of children is accessible through the getContent() method. Content can be appended to an element or to a document with the heavily overloaded addContent() method, or removed from the tree using the heavily overloaded removeContent() method. Other mutation operations, such as inserting a node at the beginning or in the middle of an element's children, require using the methods ...

Get Processing XML with Java™: A Guide to SAX, DOM, JDOM, JAXP, and TrAX now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.