XML - Tree Structure

An XML document is always descriptive. The tree structure is often referred to as XML Tree and plays an important role to describe any XML document easily.

The tree structure contains root (parent) elements, child elements and so on. By using tree structure, you can get to know all succeeding branches and sub-branches starting from the root. The parsing starts at the root, then moves down the first branch to an element, take the first branch from there, and so on to the leaf nodes.


Following example demonstrates simple XML tree structure −

<?xml version = "1.0"?>

Following tree structure represents the above XML document −

XML Trees Structure

In the above diagram, there is a root element named as <company>. Inside that, there is one more element <Employee>. Inside the employee element, there are five branches named <FirstName>, <LastName>, <ContactNo>, <Email>, and <Address>. Inside the <Address> element, there are three sub-branches, named <City> <State> and <Zip>.

Kickstart Your Career

Get certified by completing the course

Get Started