Notice that the root element in XML document above is
named <bookstore>. All other elements in the document are
contained within <bookstore> tag.
The <bookstore> element
represent the root node of the DOM tree.
The root node <bookstore> holds four <book> child node.
The first <book> child node also holds four children:
<title>, <author>, <year>, and <price>, which contain one text
node each, "Everyday Italian", "Giada De Laurentiis", "2005",
IMPORTANT! Text is always stored in text node. A
common error in DOM processing is to navigate to an element node
and expect it to contain text. However, even the simplest
element node has text node under it. For example, in
<year>2005</year>, there is an element node (year), and a text
node under it, which contain the text (2005).
The following image illustrate a fragment of the DOM node
tree from the XML document above: