The DOM is an application programming interface that is linked to HTML, XHTML, or XML documents and treats these similar to a tree where each node in the tree represents a part of the document.
In simple words, the DOM can be compared to a tree where there is a root node, intermediate nodes, and leaf nodes.
Shown here is a sample DOM:
![](/api/v2/epubs/9781789612486/files/assets/0af65b38-823b-401f-b0d3-7ba4ee206cc7.png)
In the preceding diagram, ...