3.4. W3C Document Object Model

Like SAX, the Document Object Model (DOM) is another way that applications can access the data found inside an XML document. However, instead of the application getting the data directly with event handlers, DOM creates an in-memory tree of objects that the applications can traverse to extract the information at will.

As you may remember from our parsing example at the beginning of this chapter, as part of parsing an XML document, we can create a hierarchical representation in memory of that document consisting of Java objects. The W3C Document Object Model, or DOM, uses this hierarchical representation to allow developers to further manipulate an XML document.

The DOM has three core functions to XML: 1) it represents ...

Get Enterprise Application Integration With XML and Java™ now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.