Structure of an XML Document

In an XML document, the data are stored in a hierarchical fashion. A hierarchy is
also referred to as a tree in data structures. Conceptually, the data stored in the
Catalog1.xml can be represented as a tree diagram as shown in Figure. Please
note that certain element names and values have been abbreviated in the tree diagram,
mostly to conserve real estate on the page.
In Figure, each rectangle is a node in the tree. Depending on the context,
a node can be of different types. For example, each product node in the figure is
an “element-type” node. Each product node happens to be a child node of the catalog
node.The catalog node can also be termed as the parent of all product nodes.
Each product node, in turn, is the parent of its PId, PName, and Price nodes.
In this particular tree diagram, the bottom-most nodes are not of element-type,
but rather of text-type.There could have been nodes for each attribute and its
value too, although we have not shown those in this diagram.
The Product nodes are the immediate descendants of the Catalog node. Both
Product nodes are siblings of each other. Similarly, the PId, PName, and Price nodes
under a specific product node are also siblings of each other. In short, all children
of a parent are called siblings. Figure illustrates these terms.

0 comments: