May 27, 2021 XML DOM
XML DOM treats XML documents as a node tree.
All nodes in the tree have relationships with each other.
XML DOM treats XML documents as a tree structure. This tree structure is called the node tree.
All nodes can be accessed through this tree. They can be modified or deleted, or new elements can be created.
This node tree shows the collection of nodes and their connections. The tree starts at the root node and then grows branches to the text node at the lowest level of the tree:
The picture above shows the XML file .xml.
Nodes in the node tree have hierarchical relationships with each other.
Parent, child, and peer nodes are used to describe this relationship. T he parent node has child nodes, which are at the same level and are called peer nodes (brothers or sisters).
The following image shows a part of the node tree and the relationship between nodes:
Because XML data is constructed as a tree, it can be traversed without knowing the exact structure of the tree and the type of data it contains.
You'll learn more about traversing the node tree later in this tutorial.
Take a look at the following XML clip:
<bookstore>
<book category="cooking">
<title lang="en">Everyday Italian</title>
<author>Giada De Laurentiis</author>
<year>2005</year>
<price>30.00</price>
</book>
</bookstore>
In the XML above, the element is the first child node of the element, while the element is the last child node of the element.
In addition, the element is the parent node of the element.
Tip: There are 12 node types in XML, of which 5 are the most common basic node types, as follows: