This reference section documents the W3C Document Object Model (DOM) Level 3 Core Recommendation dated 07 April 2004. The latest version of this recommendation, along with any errata that have been reported, is available on the W3C DOM Activity's web site (http://www.w3.org/DOM/DOMTR). The symbols (2) and (3) will be used throughout this chapter to indicate in which DOM level a feature became available.
The Document Object Model (DOM) is a language- and platform-independent object framework for manipulating structured documents (see Chapter 19 for additional information). Just as XML is a generic specification for creating markup languages, the DOM Core defines a generic library for manipulating markup-based documents. The W3C DOM is actually a family of related recommendations that provide functionality for many types of document manipulation, including event handling, styling, traversing trees, manipulating HTML documents, and so forth. But most of these recommendations are built on the basic functionality provided by the Core DOM.
The DOM presents a programmer with a document stored as a
hierarchy of Node
objects. The
Node
interface is the base interface
for every member of a DOM document tree. It exposes attributes common to
every type of document object and provides a few simple methods to
retrieve type-specific information without resorting to downcasting.
This interface also exposes all methods used to query, insert, and
remove objects from the document hierarchy. The Node
interface makes it easier to build
general-purpose tree-manipulation routines that are not dependent on
specific document element types.
The following table shows the DOM object hierarchy:
Object | Permitted child objects |
---|---|
| |
| |
None (leaf node) | |
| |
| |
| |
None (leaf node) | |
None (leaf node) | |
None (leaf node) | |
None (leaf node) | |
| |
None (leaf node) |