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

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.

主站蜘蛛池模板: 武穴市| 庆阳市| 宿松县| 南涧| 静安区| 会同县| 洛川县| 武义县| 沅江市| 淮南市| 上犹县| 阳谷县| 宾阳县| 比如县| 威宁| 财经| 吉木乃县| 威宁| 华阴市| 浪卡子县| 江孜县| 永州市| 隆尧县| 景泰县| 闽侯县| 安吉县| 紫金县| 潞城市| 富源县| 永春县| 定边县| 岱山县| 桑日县| 晋城| 驻马店市| 朔州市| 东安县| 祁连县| 林甸县| 黄石市| 甘孜县|