The Node Interface

Once you've parsed the document and formed an org.w3c.dom.Document object, you can forget about the differences among the various parsers and just work with the standard DOM interfaces.[1]

[1] At least until you want to write the document back out to a file again. Then you have to consider parser-specific classes or JAXP once more.

All of the nodes in the tree are represented by instances of the Node interface summarized in Example 9.8.

Example 9.8. The Node Interface
 package org.w3c.dom; public interface Node { // Node type constants public static final short ELEMENT_NODE = 1; public static final short ATTRIBUTE_NODE = 2; public static final short TEXT_NODE = 3; public static final short CDATA_SECTION_NODE = 4; public static ...

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.