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 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.