Summary

The Document Object Model, DOM, is a W3C standard API for reading and writing XML and HTML documents represented as trees. DOM is defined in IDL, but there are standard bindings for Java. In DOM, an XML document is represented as a connected tree of Node objects. The root of the tree is a Document object. Other kinds of nodes found in the tree include Element, Text, Comment, ProcessingInstruction, and several more. The basic Node interface provides generic methods to navigate the tree, as well as to get the names, values, local names, prefixes, types, and namespace URIs of each node. Because not all of these properties really make sense for all kinds nodes, many of these methods can return null.

DOM Level 2 does not provide any standard ...

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.