Description #
XML (eXtensible Markup Language) is a markup language designed to store and transport data in a format that is both human-readable and machine-readable. Unlike HTML, which is focused on displaying content, XML focuses on defining custom data structures with a strict hierarchical format.
History #
XML was developed by the World Wide Web Consortium (W3C) and released in 1998 as a simplified, flexible alternative to SGML. It quickly became the standard for data exchange across platforms, especially in web services, configuration files, and enterprise applications. Though JSON has overtaken XML in many modern APIs, XML remains widely used in finance, publishing, document storage, and legacy systems.
Key milestones:
- 1998: XML 1.0 released by W3C
- 2001–2010: Used extensively in SOAP, RSS, XHTML, and Microsoft Office formats
- Still foundational in Android development, SVG graphics, and system configurations
Hello World Code #
<?xml version="1.0" encoding="UTF-8"?>
<message>
<greeting>Hello, World!</greeting>
</message>
How to Run #
View in Browser:
- Save the code in a file named
hello.xml
- Open the file in any modern web browser
Using Online XML Tools:
- Paste into an XML viewer like https://codebeautify.org/xmlviewer
- Use developer tools in your browser to inspect the rendered structure
Using Code:
- Parse XML using JavaScript, Python, Java, etc. using built-in XML parsers (e.g.,
DOMParser
,xml.etree.ElementTree
)
Key Concepts #
- Elements are enclosed in
<tags>
with start and end markers - Data is structured hierarchically (tree format)
- Attributes add metadata to elements
- The root element wraps the entire document
- XML is case-sensitive
- Requires well-formed syntax (proper nesting, closing tags)
- Can be validated using a DTD or XSD schema
- Commonly used in RSS feeds, SOAP APIs, Android UI
- Extensible — you define your own tag names
- Used in many legacy and enterprise systems
Try It Online #
Fun Facts #
- Microsoft Office formats (like
.docx
,.xlsx
) are actually ZIP files containing XML - Android UI is mostly built using XML layout files
- SVG (Scalable Vector Graphics) is an XML-based image format
- XML is still dominant in enterprise IT due to its strictness and compatibility
- You can define your own XML-based languages, such as MathML or SOAP