Web based School

XML Tree Structure


In the previous tutorials we learned about XML syntax and discussed few examples of XML. In this guide, we will talk about the Tree structure of a XML document.
XML Tree
XML document has a tree structure, where the root element is at the top and the child elements are connected to the root elements, the same way, how leaves are connected to tree through branches. We will first see an example of XML document and then we will draw a tree structure based on the example.
Example of XML document
<?xml version="1.0" encoding="UTF-8"?> <company> <employee> <name>Negan</name> <age>40</age> <email>imnegan@twd.com</email> <address> <city>Noida</city> <state>Uttar Pradesh</state> <pin>201301</pin> <landmark>Near hill top</landmark> </address> </employee> </company> Tree Structure
The tree structure of the above XML document would look like this:
XML Tree Structure
Root element: <company> Child elements: <name>, <age>, <email> & <address> Sub-child elements: <city>, <state>, <pin> & <landmark>

Previous Next