XML Tree Structure
XML documents form a tree structure that starts at "the root" and branches out to "the leaves".
An XML Document Example
XML documents use a simple, self-descriptive syntax:
The first line is the XML declaration. It defines the XML version (1.0) and the encoding used (UTF-8: Unicode, can display various languages).
The next line describes the document'sroot element(as if saying: "This document is a note"):
<note>
The next 4 lines describe the root's 4child elements(to, from, heading, and body):
The last line defines the end of the root element:
</note>
You can assume, from this example, that the XML document contains a note from Jani to Tove.
XML is remarkably self-descriptive, don't you agree?
XML Documents Form a Tree Structure
XML documents must containa root element. This element is the parent of all other elements.
The elements in an XML document form a document tree. The tree starts at the root and expands to the lowest level of the tree.
All elements can have child elements:
Terms like parent, child, and sibling are used to describe the relationships between elements. Parent elements have children. Children on the same level are called siblings (brothers or sisters).
All elements can have text content and attributes (similar to HTML).
Example:

The image above represents a book in the XML below:
XML Document Example
The root element in the example is <bookstore>. All <book> elements in the document are contained within <bookstore>.
The <book> element has 4 child elements: <title>, <author>, <year>, <price>.
Other extensions