Skip to content
Search

Document Object Model

lastmod 2026-03-30created 2014-09-1910 edits

The Document Object Model (DOM) is a format for representing structured documents as an object-oriented model. The DOM is the official W3C standard for representing structured documents in a platform- and language-neutral way. The DOM is also the basis for several APIs standardized by the W3C.

The DOM was first supported in web browsers to control elements of HTML documents. The DOM was a means of dynamically accessing and changing a document's content, structure, and style. Because DOM implementations were incompatible across browsers, the W3C came to write the DOM standard specification.

The DOM places no restrictions on the data structure underlying a document. A well-structured document can be turned into a tree structure using the DOM. Most XML parsers and XSL processors were developed to support the use of tree structures. In such implementations, the entire content of the document must be parsed and stored in memory. For this reason, the DOM is best suited for applications where document elements must be accessed and changed arbitrarily. In XML-based applications where only a single selective read/write happens per parse, the DOM puts a significant load on memory. In situations like this, where speed and efficient memory consumption matter, the SAX model has the advantage.

What is the DOM?

The Document Object Model (hereafter DOM) is a programming interface for HTML and XML documents. The DOM provides a structured representation of the document and gives programming languages a way to access the DOM structure, helping them change the document's structure, style, content, and so on. The DOM represents the document as structured nodes and objects that have properties and methods. These serve to connect web pages to scripts or programming languages so they can be used there.

A web page is a kind of document. Its content is interpreted by the web browser and shown on the browser screen, or it may be shown as the HTML source itself. It is worth noting that the same document can appear in such different forms. The DOM provides a way to represent, store, and manipulate the same document. The DOM is an object-oriented representation of a web page, and it can be modified using a scripting language such as JavaScript.

Libraries

  • DOM implementations.
    • libxml2
    • MSXML
    • Xerces is a C++ DOM implementation with Java and Perl bindings.
  • APIs that expose DOM implementations.
    • JAXP (Java API for XML Processing) is an API for accessing DOM providers
  • ETC
    • Ajax (a methodology employing DOM in combination with techniques for retrieving data without reloading a page)
    • Application Object Model
    • DOM scripting
    • JDOM (a Java-based document object model for XML that integrates with DOM and SAX and uses parsers to build the document)
    • jQuery
    • JSON
    • Prototype.js
    • RapidXml (is an attempt to create the fastest XML parser possible using modern C++)
    • SAX (serial access parser API for XML, an alternative to DOM)
    • SXML (a model for representing XML and HTML in the form of S-expressions)
    • TinyXML (efficient platform-independent XML library for C++)

See also

Favorite site

author Zer0 sitemap