$devtoolkit.sh/glossary/what-is-xml

What is XML? — Extensible Markup Language Explained

Definition

XML (Extensible Markup Language) is a text-based markup language that uses angle-bracket tags to encode data in a structured, hierarchical format. Unlike HTML, XML does not have predefined tags — you define your own element names to describe the structure of your data. XML was the dominant data exchange format in enterprise software and web services throughout the 2000s, and it remains widely used in RSS feeds, SOAP APIs, Android layouts, Office documents (.docx, .xlsx), and SVG graphics.

How It Works

An XML document consists of a tree of elements. Each element has an opening tag <name>, optional content (text or child elements), and a closing tag </name>. Self-closing tags <name /> are used for empty elements. Elements can have attributes (key="value" pairs inside the opening tag). Every XML document must have exactly one root element, all tags must be properly closed and nested, attribute values must be quoted, and certain characters (<, >, &, ", ') must be escaped as entities. A DTD or XML Schema (XSD) can define rules for what elements and attributes are valid.

Common Use Cases

  • Exchanging data with SOAP web services and legacy enterprise APIs
  • Defining Android UI layouts in res/layout/ XML files
  • Publishing RSS and Atom feeds for blog and podcast syndication
  • Storing Microsoft Office documents (Word, Excel use XML internally in the .docx/.xlsx formats)
  • Describing SVG vector graphics embedded in web pages

Example

<?xml version="1.0" encoding="UTF-8"?>
<users>
  <user id="42">
    <name>Alice</name>
    <email>[email protected]</email>
    <active>true</active>
  </user>
</users>

Related Tools

FAQ

Is XML still relevant today?
Yes, though less so than in the 2000s. XML remains the standard for SOAP services, Android layouts, RSS/Atom feeds, SVG, XHTML, and the internal format of .docx and .xlsx files. For new JSON-compatible REST APIs, JSON has largely replaced XML.
What is an XML namespace?
XML namespaces allow you to mix tags from different XML vocabularies in a single document without naming conflicts. A namespace is declared with xmlns="uri" or xmlns:prefix="uri" and associates tags with a specific vocabulary identified by the URI.
What is the difference between DTD and XSD?
A DTD (Document Type Definition) is an older, limited way to define valid XML structure. An XSD (XML Schema Definition) is more powerful: it supports data types (integers, dates, etc.), namespaces, and complex validation rules. XSD is preferred for modern XML validation.

Related Terms

/glossary/what-is-xmlv1.0.0