From Wikipedia, the free encyclopedia.
Document Object Model (DOM) is a form of representation of structured documents as an object-oriented model. DOM is the official World Wide Web Consortium (W3C) standard for representing structured documents in a platform- and language-neutral manner.
DOM was initially supported by web browsers to manipulate elements in a HTML document. DOM was a way of dynamically accessing and updating the content, structure and style of documents. Owing to incompatibilites in the DOM implementation between different browsers, the W3C came up with standard specifications for DOM. The foundation of the specifications was based on XML which at the time was emerging as a competitor to HTML in the area of structured languages.
DOM doesn't put restrictions on what the document's underlying data structure is. A well-structured document can take the tree form using DOM. Most XML parsers (e.g., Xerces) and XSL processors (e.g., Xalan) have been developed to make use of the tree structure. Such an implementation requires that the entire content of a document be parsed and stored in memory. Hence, DOM is best used for applications where the document elements have to be randomly-accessed and manipulated. For XML-based applications which involve a one-time selective read/write per parse, DOM presents a considerable overhead on memory. The SAX model is advantageous in such a case in terms of speed and memory consumption.
The custodian of the DOM is the World Wide Web Consortium (W3C). The current DOM specification is Level 2. Level 1 specification allowed for navigation of an HTML or XML document and to manipulate content. Level 2 came up with XML Namespace support, filtered views and events. Level 3 specification is (as of 2003) a working draft and still under development at the W3C.
A different DOM implementation from Microsoft has led to inter-operability problems for web browsers.
As Microsoft's Internet Explorer browser is, as of 2004, the de-facto standard web browser, this poses real problems for the developers of more standards-compliant browsers such as Mozilla. If they adopt the Microsoft extensions to the DOM, they risk losing any credibility in their calls for web-sites to become standards-compliant, and if they do not, they risk alienating their users by losing much or all of the content of web-sites which use the non-standard extensions. Cynics regard this as another case of Microsoft applying embrace, extend and extinguish tactics. This could be considered ironic, as both Microsoft and Netscape were guilty of supplying non-standard features in an arms-race for standards control, and Mozilla was born out of a Netscape initiative.
The general consensus appears to be that this will only change if new standards-compliant browsers gain a significant market-share on the Web, thus making the use of non-standard extensions a commercial problem for the authors of non-standards-compliant websites.
Internet Explorer 7.0 is rumoured to likely be more standards-compliant in its implementation of the DOM, but is unlikely to pull support for the current proprietary DOM extensions.