| home / experts / xml / column11 |
|
|
While SAX is a fairly simple and elegant solution to processing XML, it puts the burden of storing and manipulating the XML data on the programmer. While this can be an advantage under certain circumstances, as we will see later, it is certainly not the most convenient way to deal with XML.
The W3C realized early on that a Document Object Model would be helpful for XML in the same way it proved to be useful for HTML, especially in its scripting-enabled version, Dynamic HTML. An XML-enabled browser could parse the incoming XML and build an in-memory object structure from it that could then be manipulated through your favorite scripting language. Establishing this standard early on could avoid the pain and hassle we have to live with in the HTML world, where browsers rarely conform 100 percent to the HTML DOM specification. Luckily, both Internet Explorer, albeit with inevitable Microsoft extensions, and the new Mozilla browser seem to now zero in on a standards-compliant DOM implementation.
This level defines a minimal set of objects and interfaces for accessing and manipulating document objects. The functionality specified here (the Core functionality) should be sufficient to allow software developers and Web script authors to access and manipulate parsed HTML and XML content inside conforming products. The DOM Core API also allows population of a document object using only DOM API calls; creating the skeleton document and saving it persistently is left to the product that implements the DOM API.
The DOM presents documents as a hierarchy of node objects that also implement other, more specialized interfaces. Some types of nodes may have child nodes of various types, and others are leaf nodes that cannot have anything below them in the document structure. The node types, and which node types they may have as children, are as follows:
The DOM also specifies a NodeList interface to handle ordered lists of nodes, such as the children of a node. A NamedNodeMap interface also exists to handle unordered sets of nodes referenced by their name attribute, such as the attributes of an element.
DOM Level 2 builds on level 1. It adds new platform-independent and language-independent interfaces for the following:
Produced by Michael Claßen
All Rights Reserved. Legal Notices.
URL: http://www.webreference.com/xml/column11/2.html
Created: Apr. 18, 2000
Revised: Apr. 26, 2000