BeginnersBook

  • Home
  • Java
    • Java OOPs
    • Java Collections
    • Java Examples
  • C
    • C Examples
  • C++
    • C++ Examples
  • DBMS
  • Computer Network
  • Python
    • Python Examples
  • More…
    • jQuery
    • Kotlin
    • WordPress
    • SEO
    • JSON
    • JSP
    • JSTL
    • Servlet
    • MongoDB
    • XML
    • Perl

XML Tree Structure

Last Updated: October 25, 2018 by Chaitanya Singh | Filed Under: XML Tutorial

In the previous tutorials we learned about XML syntax and discussed few examples of XML. In this guide, we will talk about the 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>[email protected]</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>

Top Related Articles:

  1. JSON vs XML
  2. XML Example
  3. XML DTD
  4. XML Comments
  5. XML Attributes

About the Author

I have 15 years of experience in the IT industry, working with renowned multinational corporations. Additionally, I have dedicated over a decade to teaching, allowing me to refine my skills in delivering information in a simple and easily understandable manner.

– Chaitanya

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Copyright © 2012 – 2025 BeginnersBook . Privacy Policy . Sitemap