The Evolution of DOM

The first version of DOM, sometimes called DOM Level 0, wasn't an official specification but merely the object model that Netscape Navigator 3 and Internet Explorer 3 browsers implemented. (These were actually two different object models only marginally compatible with each other.)

DOM Level 0 applied only to HTML documents and only in the context of JavaScript. Nonetheless, both the usefulness of JavaScript and the growing incompatibility between the two browser object models underscored the need for something more standard. Hence, the W3C launched the W3C DOM Activity and began work on DOM Level 1. DOM1 was an attempt to devise a specification as quickly as possible that would codify existing practice and also achieve some level of compatibility across browsers. Given the constraints under which the working group labored, DOM1 is a surprisingly good specification. Although the naming conventions feel wrong to a Java developer, DOM1 does provides a solid core of functionality that covers maybe 75 percent of what developers want to do when processing XML.

DOM Level 2 cleaned up the DOM1 interfaces. The big change was namespace support in the Element and Attr interfaces. In addition, DOM2 added a number of supplementary interfaces for events, traversal, ranges, views, and stylesheets. I'll address these in upcoming chapters. In 2002, all significant XML parsers that support DOM support DOM2. There's not a lot of reason to worry about the difference between DOM1 and DOM2. From this point forward, I'm just going to teach DOM2.

DOM Level 3 is visible not far up the road. Parts of it are just beginning to be supported by bleeding-edge parsers, most especially Xerces 2. In the core, DOM3 just adds a few missing pieces needed to allow DOM to fully support all XML Information Set (Infoset) properties. This includes the original encoding and base URI of the document. However, DOM3 will also provide some crucial functionality missing from DOM2. In particular, DOM2 doesn't provide a parser-independent means to create a new Document object, either by parsing a file or by building one from scratch in memory. DOM3 will provide standard ways of doing both. DOM3 will also add a lot more support for DTDs and schemas. But despite all its new features and functionality, DOM3 will not replace DOM2. Everything that works today in DOM2 will continue to work the same way in DOM3. DOM3 extends the DOM into new territory, but it doesn't change what has gone before it.

Processing XML with Java. A Guide to SAX, DOM, JDOM, JAXP, and TrAX
Processing XML with Javaв„ў: A Guide to SAX, DOM, JDOM, JAXP, and TrAX
ISBN: 0201771861
EAN: 2147483647
Year: 2001
Pages: 191 © 2008-2017.
If you may any questions please contact us: