The Element Interface

The Element interface is perhaps the most important of all the DOM component interfaces. After all, it's possible to write XML documents without any comments, processing instructions, attributes, CDATA sections, entity references, or even text nodes. By contrast, every XML document has at least one element, and most XML documents have many more. Elements, more than any other component, define the structure of an XML document.

Example 11.1 summarizes the Element interface. This interface includes methods to get the prefixed name of the element, manipulate the attributes on the element, and select from the element's descendants. Of course, Element objects also have all the methods of the Node superinterface, such as appendChild() ...

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.