Open In App

What is XML ?

Extensible Markup Language (XML) is a type of markup language that establishes a set of guidelines for encoding texts in a way that is both machine- and human-readable. For storing and transferring data on the web and in many other applications, XML is widely used. XML steps in as a versatile tool for encoding and organizing data in a way that both humans and machines can comprehend.

Image-of-XML-copy

History of XML

XML emerged in the late 1990s as a revolutionary concept in the evolving landscape of the internet. Before XML, HTML served as the predominant language for web content, but it lacked the flexibility needed for complex data representation. XML arrived as a solution, offering a standardized format for expressing diverse types of data in a hierarchical structure.

Different ways of using XML

In the realm of XML, everything revolves around tags. Think of tags as containers that hold different pieces of information. Each tag has a name and can optionally carry attributes, providing additional details about the enclosed data. Here's a simple breakdown:

<element attribute="value">Text content</element>

Let's unpack this: <element> represents the name of the container, attribute is like a label describing the container's contents, and Text content is the actual information stored within the container.

Simple XML Document

<book> acts as the main container, housing details about a book such as its title, author, and publication year.

Example:

<book>
<title>Harry Potter and the Sorcerer's Stone</title>
<author>J.K. Rowling</author>
<year>1997</year>
</book>

XML with Attributes

Here, <student> serves as the container for student information, with attributes like id providing additional identifiers.

Example:

<student id="001">
<name>John Doe</name>
<age>25</age>
<grade>A</grade>
</student>

Example: the <book> element serves as the primary container, encompassing information pertaining to a book such as its title, author, and year of publication.

<book>
    <title>Harry Potter and the Sorcerer's Stone</title>
    <author>J.K. Rowling</author>
    <year>1997</year>
</book>

Output:Screenshot-2024-03-05-161640


Applications of XML

Advantages of XML

Limitations of XML

Article Tags :