1. Home
  2. Docs
  3. Web Technology I
  4. eXtensible Markup Languag...
  5. Introduction

Introduction

Here is the Introduction of XML:

Thank you for reading this post, don't forget to subscribe!
Screenshot 2024 02 12 182342
Screenshot 2024 02 12 182434

XML documents must contain one root element that is the parent of all other elements:

<root>
  <child>
    <subchild>.....</subchild>
  </child>
</root>

Example:-

<root>
  <person>
    <details>Personal Information</details>
    <name>John Doe</name>
    <age>30</age>
    <address>
      <street>Main Street</street>
      <city>City</city>
      <country>Country</country>
    </address>
  </person>
</root>
image

The syntax for writing comments in XML is similar to that of HTML:

<root>
  < !-- This is a comment -- >
  <child>
    <! -- Comments can be added anywhere in the XML document -- >
    <subchild>This is some content</subchild>
  </child>
</root>

The structure of an XML file consists of elements organized in a hierarchical manner. Each XML file must have a single root element that encloses all other elements.

• Elements can contain text, attributes, and other elements, forming a tree-like structure.

<?xml version="1.0" encoding="UTF-8"?>
<library>
    <book ISBN="978-3-16-148410-0">
        <title>XML Basics</title>
        <author>John Doe</author>
        <publication_year>2020</publication_year>
    </book>
    <book ISBN="978-3-16-148411-7">
        <title>Advanced XML</title>
        <author>Jane Smith</author>
        <publication_year>2021</publication_year>
    </book>
</library>
image 1

How can we help?