Document Object Model

The Document Object Model (DOM) is an application programming interface (API) for [[HTML]] and [[Extensible Markup Language|XML]] documents. It defines the logical structure of documents and the way a document is accessed and manipulated.

In the DOM specification, the term "document" is used in the broad sense - increasingly, XML is being used as a way of representing many different kinds of information that may be stored in diverse systems, and much of this would traditionally be seen as data rather than as documents. Nevertheless, XML presents this data as documents, and the DOM may be used to manage this data.

With the Document Object Model, programmers can build documents, navigate their structure, and add, modify, or delete elements and content. Anything found in an HTML or XML document can be accessed, changed, deleted, or added using the Document Object Model, with a few exceptions - in particular, the DOM interfaces for the XML internal and external subsets have not yet been specified.

There are 3 parts of the DOM:

  • Core DOM - standard for all document types
  • XML DOM - standard model for XML documents
  • HTML DOM - standard model for HTML documents

The Document Object Model (DOM) is a programming interface that defines how to create, modify or erase elements in an HTML or XML document. DOM provides a standard API for the dynamic modification of the content, style, and structure of web page documents. A DOM model represents each element as a node within a tree-like system, enabling easier programmatic access and management of the elements.

By allowing the manipulation of documents, a DOM model enables object-oriented web page representation. This way, programming languages like [[JavaScript]] can modify and build dynamic web pages. DOM is platform and language-neutral to be used concurrently by multiple applications and environments.