The Text Class
JDOM uses the Text class internally to represent text nodes. In normal usage, you don't deal with this class directly—you just use strings. The one time you may encounter it is when you use getContent() to retrieve all the children of the node, and you're iterating through the list returned. In this case, you will see Text objects.
Each Text object has a parent Element (which may be null) and a String value that holds the content of the node. This value may contain characters like < and &. If so, they will be escaped when the node is serialized. They do not need to be escaped before being inserted into a Text object.
The Text class, summarized in Example 15.11, has methods to get, set, and detach the parent Element; to get and ...
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.