Siksha Sarovar

Siksha Sarovar (sikshasarovar.com) is a free educational web application that helps students in India learn programming and prepare for academic and competitive exams. The platform offers structured coding courses (C, C++, Python, Java, HTML, CSS, PHP, Power BI, AI, Machine Learning, Data Science), complete university curriculum notes for BCA/MCA students with previous year question papers, Class 10 and Class 12 CBSE/HBSE school notes, and dedicated preparation material for SSC, UPSC, Banking, Railway and other government exams. Browsing the site is completely free and requires no account. Users may optionally sign in with Google solely to save their learning progress, quiz scores and personal preferences across devices.

Privacy Policy | Terms of Service | Contact Siksha Sarovar | About Siksha Sarovar

v4.0.9 · PWA
Siksha Sarovar logo
Siksha Sarovar
Your Learning Universe

Siksha Sarovar is a free e-learning platform for coding courses, BCA university notes and competitive exam preparation. Optional Google sign-in saves your learning progress across devices.

Initializing knowledge base…
Compiling modules 0%

Introduction to XML

Lesson 27 of 34 in the free Web Technologies notes on Siksha Sarovar, written by Rohit Jangra.

Introduction to XML

What is XML?

XML (eXtensible Markup Language) is a markup language designed to store, transport, and structure data. Unlike HTML (which displays data), XML is focused on describing data.

  • Defined by W3C in 1998
  • Both human-readable and machine-readable
  • Platform-independent, self-describing

XML Syntax Rules

<?xml version="1.0" encoding="UTF-8"?>
<bookstore>
    <book category="fiction">
        <title lang="en">The Great Gatsby</title>
        <author>F. Scott Fitzgerald</author>
        <year>1925</year>
        <price>12.99</price>
    </book>
    <book category="technology">
        <title lang="en">Clean Code</title>
        <author>Robert C. Martin</author>
        <year>2008</year>
        <price>35.00</price>
    </book>
</bookstore>

XML Rules

  1. Every XML document must have a root element
  2. All elements must have a closing tag
  3. Tags are case-sensitive (<Name><name>)
  4. Elements must be properly nested
  5. Attribute values must be quoted
  6. Special characters must use entities

XML vs HTML

FeatureXMLHTML
PurposeData storage/transportDisplay data
Tag namesCustom (extensible)Predefined
Closing tagsRequiredOptional (HTML5)
Case sensitivityYesNo
AttributesQuoted, requiredCan be unquoted

XML Elements and Attributes

<!-- Element with attributes -->
<student id="101" grade="A">
    <name>Alice</name>
    <email>alice@example.com</email>
    <marks>
        <subject name="Math">95</subject>
        <subject name="Science">88</subject>
    </marks>
</student>

XML Special Characters (Entities)

EntityCharacter
&&
<<
>>
''
""

XML Namespace

<root xmlns:h="http://www.w3.org/TR/html4/"
      xmlns:f="http://www.example.com/furniture">
    <h:table>
        <h:tr><h:td>HTML Table</h:td></h:tr>
    </h:table>
    <f:table>
        <f:name>Dining Table</f:name>
    </f:table>
</root>

XML Applications

  • RSS/Atom feeds – news syndication
  • SOAP web services – enterprise web services
  • SVG – scalable vector graphics
  • Office Open XML – .docx, .xlsx files
  • Android layouts – UI XML files
  • Maven/Gradle – build configuration
Key Takeaway: XML is a universal data format for storing and transporting structured data. Its strict syntax rules (proper nesting, closing tags, quoted attributes) make it reliable but verbose compared to JSON.