Developing Web Services with Java APIs for XML Using WSDP

The Document Object Model
JAXP and Underlying DOM Engines
Creating a DOM Parser
Parsing XML into a DOM
Manipulating DOM Objects
Advanced Topics
In the last chapter we discussed event-based parsing. Event-based parsing has some limitations. For instance, one cannot manipulate entire sections of a document at once. Also, multiple passes over the document data calls for multiple runs through the parser. Often, it would be more efficient if an entire document could be read into the memory and manipulated as an in-memory representation.
This can be achieved using the Document Object Model (DOM), which is by far the most widely used among the various standards proposed for in-memory representation of XML documents. A standard specified by the World Wide Web Consortium (W3C), the DOM specifies an abstract mapping of XML elements into runtime objects. Binding this specification to various languages, including Java, has been implemented by a variety of vendors.
In the DOM, every XML document is represented as a hierarchy of objects. This hierarchy forms a tree structure that mimics the structure of the XML document. Once you are familiar with XML and DOM, translating between the two becomes a simple matter.
One thing the current DOM specification omits is an API for the parsing of an XML document into a DOM. This is left to the individual vendor when writing a DOM parser. The latest DOM specification (DOM 3) seeks to address this issue too, but until it gains in popularity, application...