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>[email protected]</email> <address> <city>Noida</city> <state>Uttar Pradesh</state> <pin>201301</pin> <landmark>Near hill top</landmark> </address> </employee> </company>
The tree structure of the above XML document would look like this: