From: w3cschool cainiao tutorial
In the DOM, each component in the XML document is a node.
DOM Node
According to the DOM, each component in the XML document is a node.
DOM is as follows:
The entire document is a document Node
Each XML element is an element node.
The text contained in the XML element is a text node.
Each XML Attribute is a property node.
Annotation is a comment node.
DOM instance
See the following XML file books. xml). The Code is as follows:
<?xml version="1.0" encoding="ISO-8859-1"?><bookstore><book category="cooking"><title lang="en">Everyday Italian</title><author>Giada De Laurentiis</author><year>2005</year><price>30.00</price></book><book category="children"><title lang="en">Harry Potter</title><author>J K. Rowling</author><year>2005</year><price>29.99</price></book><book category="web"><title lang="en">XQuery Kick Start</title><author>James McGovern</author><author>Per Bothner</author><author>Kurt Cagle</author><author>James Linn</author><author>Vaidyanathan Nagarajan</author><year>2003</year><price>49.99</price></book><book category="web" cover="paperback"><title lang="en">Learning XML</title><author>Erik T. Ray</author><year>2003</year><price>39.95</price></book></bookstore>
In the preceding XML, the root node is <bookstore>. All other nodes in this document are included in <bookstore>.
The root node <bookstore> has four <book> nodes.
The first <book> node has four nodes: <title>, <author>, <year>, and <price>. Each node contains a text node, "Everyday Italian", "Giada De Laurentiis", "2005", and "30.00 ".
Text is always stored in text nodes.
A common error in DOM processing is that an element node contains text.
However, the text of the element node is stored in the text node.
In this example: <year> 2005 </year>, the element node <year> has a text node with a value of "2005.
"2005" is not the value of the <year> element!
Reprinted Please note: http://www.w3cschool.cc/dom/dom-nodes.html