Navigating JDOM Trees

Once you've parsed a document and formed a Document object, you'll probably want to search it to select the parts of it your program is interested in. In JDOM, most navigation takes place through the methods of the Element class. The complete children of each Element are available as a java.util.List returned by the getContent() method. Only the child elements of each Element are available as a java.util.List returned by the getChildren() method.[2]

[2] Yes, the terminology is a little confusing here. This is a case in which JDOM is marching out of step with the rest of the XML world. JDOM uses the word children to refer only to child elements.

Because JDOM uses the Java Collections API to manage the tree, it is simultaneously ...

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.