官术网_书友最值得收藏!

What is the DOM?

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.

The root node has no parent; the intermediate nodes have a parent, one or more siblings, and one or more children. This is a very important concept and will help at the time of creating relative or customized XPaths, which we will see in a later part of the chapter.

Shown here is a sample DOM:

In the preceding diagram, there are three leaf nodes, two intermediate nodes, and one root node. All of this is contained in a document. The question that arises next is: how do we get to a particular node in this tree structure? This is where terms such as XPath and CSS come into picture.

XPath stands for XML Path and is a querying language to query the nodes in a DOM.

CSS stands for Cascading Style Sheets and is a style sheet language used for describing the look and format of a document written in any markup language.

主站蜘蛛池模板: 北流市| 蛟河市| 荃湾区| 宁津县| 微山县| 蒙阴县| 柞水县| 余庆县| 翁源县| 农安县| 施秉县| 临颍县| 榆社县| 舞阳县| 鄂托克旗| 南投县| 鄂州市| 磐石市| 东明县| 漳州市| 凤山县| 石阡县| 中西区| 蛟河市| 克山县| 金湖县| 余庆县| 海口市| 宜昌市| 牟定县| 汾阳市| 仪征市| 洪泽县| 高尔夫| 衡阳市| 犍为县| 益阳市| 高唐县| 神池县| 任丘市| 额敏县|