Your support for our advertisers helps cover the cost of hosting, research, and maintenance of this FAQ

The XML FAQ — Frequently-Asked Questions about the Extensible Markup Language

Section 1: Basics

Q 1.3: What is XML for?

XML is for identification, transmission, and storage.

Its goal is to enable generic SGML to be served, received, and processed on the Web in the way that is now possible with HTML. XML has been designed for ease of implementation and for interoperability with both SGML and HTML.

(Bray, Paoli, Sperberg-McQueen, Maler and Yergeau, 2004)

Despite early attempts, browsers never allowed other SGML, only HTML (although there were plugins). Browsers also allowed (even encouraged) authors to corrupt or break their HTML in order to make it ‘easier’. This enabled HTML to become widespread, but held development back for over a decade by making it impossible to program for it reliably. XML fixes that by making it compulsory to stick to the rules, and by making the rules much simpler than SGML.

But XML is not just for Web pages: in fact it's very rarely used on its own for Web pages because browsers still don't provide reliable support for formatting it. Common uses for XML include:

Information identification

You can define your own markup, so you can define meaningful names for all your information items.

Information storage

Because XML is portable and non-proprietary, it can be used to store information across any platforms. Because it is backed by an international standard, it will remain accessible and processable as a data format.

Information structure

XML structures can ‘nest’, so they can be used to store and identify any kind of hierarchical information, especially long, deep, or complex document sets or data sources, which makes it ideal for an information-management back-end to serving the Web. This is one if its most common Web applications, with a transformation system to serve it as HTML.

Publishing

The original goal of XML as defined in the quotation at the start of this section. Combining the three previous topics (identity, storage, and structure) means it is possible to get all the benefits of robust document management and control (with XML) and publish to the Web (as HTML) as well as to paper (as PDF) and to other formats (eg Braille, Audio, etc) from a single source document by using the appropriate stylesheets.

Messaging and data transfer

XML is also very heavily used for enclosing or encapsulating information in order to pass it between different computing systems which would otherwise be unable to communicate because of their proprietary or secret data formats. By providing a lingua franca for data identity and structure, XML provides a common ‘envelope’ for inter-process communication (messaging).

Web services

Building on all of these, as well as its use in browsers, machine-processable data can be exchanged between consenting systems, where before it was only comprehensible by humans (HTML). Weather services, e-commerce sites, blog newsfeeds, AJaX sites, and thousands of other data-exchange services like smartphone apps use XML for data management and transmission, and the web browser or app for display and interaction.