XML technologies / XML / XML in a Nutshell / The Document Object Model (DOM) / DOM Level 3 interfaces
(Excerpt from "XML in a Nutshell" by Elliotte Rusty Harold & W. Scott Means)
DOM Level 3 includes new interfaces supporting the following features:
XML version 1.1
Dynamic selection of a DOM implementation
General document type information after validation
Dynamic error handling
The following sections describe the new interfaces introduced in DOM Level 3.
DOMStringList
The interface DOMStringList models a simple helper class containing an ordered list of DOMString objects. The following table describes the interface DOMStringList.
Table: The interface DOMStringList
Name | Type | Read-only? |
|---|---|---|
| ||
|
|
|
| ||
|
| |
|
|
NameList
The interface NameListmodels an ordered collection of names and corresponding URIs. One possible use is to model the association between namespace prefixes and namespace URIs. The following table describes the interface NameList.
Table: The NameList interface
Name | Type | Read-only? |
|---|---|---|
| ||
|
|
|
| ||
|
| |
|
| |
|
| |
|
|
DOMImplementationList
The interface DOMImplementationList models a list of DOMImplementation objects. It is shown in the following table.
Table: The DOMImplementationList interface
Name | Type | Read-only? |
|---|---|---|
| ||
|
|
|
| ||
|
|
DOMImplementationSource
The interface shown in the next table DOMImplementationSource allows a DOM client to select a particular implementation dynamically from those available, based on a required set of features. It also lets the client retrieve the complete list of all DOMImplementation objects available at runtime.
Table: The interface DOMImplementationSource
Name | Type | Read-only? |
|---|---|---|
| ||
|
| |
|
|
TypeInfo
One of the most important improvements in DOM Level 3 is the availability of type information in the DOM tree after a document has been parsed and validated. The interface described in the following table TypeInfo provides a very simple interface through which a DOM implementation can supply schema-independent type information for elements and attributes in the DOM tree.
Table: The TypeInfo interface
Name | Type | Read-only? |
|---|---|---|
| ||
|
|
|
|
|
|
| ||
|
|
UserDataHandler
DOM Level 3 lets developers attach their own custom data to any Node in the current DOM tree. The interface UserDataHandler is a callback interface developers can implement to receive notifications of operations performed on nodes, such as cloning, deletion, or movement. Its method is listed in the following table.
Table: The UserDataHandler interface
Name | Type | Read-only? |
|---|---|---|
| ||
|
|
DOMError
Before Level 3, all DOM error handling used the DOMException mechanism. Level 3 introduces a new error-handling facility that lets developers register a callback object implementing the interface DOMErrorHandler, which is notified when an error occurs during DOM operations. The interface DOMError describes an object containing information about such an error. The interface DOMError is described in the following table.
Table: The interface DOMError
Name | Type | Read-only? |
|---|---|---|
| ||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DOMErrorHandler
Unlike earlier DOM levels, Level 3 lets developers create a callback object that can be notified when an error occurs during DOM processing. This is done by creating an object implementing the interface DOMErrorHandler. If an error occurs during a DOM operation, such as a validity error while inserting a node, the method handleError( ) is called with detailed error information. The interface’s method appears in the following table.
Table: The interface DOMErrorHandler
Name | Type | Read-only? |
|---|---|---|
| ||
|
|
DOMLocator
The interface shown in the next table DOMLocator describes a location within a DOM document. It is used mainly by the new DOMError interface to supply detailed information about where an error occurred.
Table: The interface DOMLocator
Name | Type | Read-only? |
|---|---|---|
| ||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DOMConfiguration
The interface shown in the following table DOMConfiguration provides a general container for configuration parameters affecting XML processing when it is first parsed or processed again with the method Document.normalizeDocument( ). For a complete list of parameters recognized by DOM Level 3 implementations, see DOMConfiguration in the DOM reference.
Table: The interface DOMConfiguration
Name | Type | Read-only? |
|---|---|---|
| ||
|
|
|
| ||
|
| |
|
| |
|
|
Copyright © 2005 O'Reilly Verlag GmbH & Co. KG
You may print the online version for your private use.
Otherwise, this chapter from the book "XML in a Nutshell" is subject to the same conditions as the printed edition: the work and all its parts are protected by copyright. All rights reserved, including reproduction, translation, microfilming, and storage and processing in electronic systems.
O’Reilly Verlag GmbH & Co. KG, Balthasarstraße 81, 50670 Köln, kommentar(at)oreilly.de