XML DOM Node Tree
The XML DOM views an XML document as a node tree.
All nodes in the tree have relationships with each other.
XML DOM Node Tree
The XML DOM views an XML document as a tree structure. This tree structure is callednode tree.
All nodes can be accessed through this tree. Their content can be modified or deleted, and new elements can be created.
This node tree shows the collection of nodes and the relationships between them. The tree starts at the root node and branches out to text nodes at the lowest level of the tree:

The image above represents the XML file books.xml.
Parent, Child and Sibling Nodes
Nodes in a node tree have hierarchical relationships with each other.
Parent, child and sibling nodes are used to describe these relationships. A parent node has child nodes, and child nodes at the same level are called siblings (brothers or sisters).
- In a node tree, the node at the top is called the root node
- Every node except the root node has a parent node
- A node can have any number of child nodes
- A leaf is a node with no child nodes
- Sibling nodes are nodes that have the same parent node
The image below shows part of a node tree and the relationships between the nodes:

Because XML data is structured as a tree, it can be traversed without knowing the exact structure of the tree or the types of data it contains.
You will learn more about traversing the node tree in later chapters of this tutorial.
First Child - Last Child
Please look at the following XML fragment:
<
bookstore
<
book
category
=
"
cooking
"
<
title
lang
=
"
en
"Everyday Italian
title
<
author
Giada De Laurentiis
author
<
year
2005
year
<
price
30.00
price
book
bookstoreIn the XML above,
In addition,