XML Tree -: XML documents seemed like a tree. A tree start his root and have a many branched. XML documents have a hierarchical structure and conceptual as a tree structure so it is called XML tree.
XML documents must contain a root element (one that is the parent of all other elements are child elements). All elements in an XML document can contain sub elements, text and attributes.
The tree represented by an XML document starts at the root element and branches to the lowest level of elements. Although there is no consensus on the terminology used on XML Trees, at least two standard terminologies have been released by the W3C.
- XPath Data Model-: XPath defines a syntax named XPath expressions that identifies one or more internal components like elements, attributes, etc. of an XML document. XPath is widely used to accesses XML encoded data.
- XML Information Set-: This describes an abstract data model for XML documents in terms of information items.
XML Tree Structure -: The XML Information Set are describes an abstract data model for XML documents in terms of information items. XML documents are formed as element trees . XML tree starts at a root element and branches from the root to child elements. All elements can have sub elements called child elements. For example of XML Tree structure
<root> <child> <subchild> ........ </subchild> </child> </root>
in this example terms parent, child, and sibling are used to describe the relationships between elements. Parents have children. Children have parents. Siblings are children on the same level (brothers and sisters).
Write a program to showing XML tree structure example-:
<?xml version="1.0" encoding="utf-8" ?> <company> <employee> <FullName>vikram singh</FullName> <IdNumber>1001</IdNumber> <ContactNumber>00000000</ContactNumber> </employee> <Homeaddress> <housenumber>202</housenumber> <wardNumber>05</wardNumber> <city>Jaipur India</city> </Homeaddress> </company>
XML uses a much self-describing syntax. In this example it showing the version of XML 1.0 and root element are the company. Branches are the employee and homeaddress .