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.14: Why should I use XML?
It's a robust, durable, manipulable, and free format for information identification, storage and transfer.
Here are a few reasons for using XML (in no particular order). Not all of these will apply to your own requirements, and you may have additional reasons not mentioned here (if so, please let the editor of the FAQ know!).
XML can be used to describe and identify information accurately and unambiguously, in a way that computers can be programmed to ‘understand’ your information (well, at least manipulate as if they could understand it).
XML allows sets of documents which are all the same type to be created and handled consistently and without structural errors, because it provides a standardised way of describing, controlling, or allowing/disallowing particular types of document structure. [Note that this has absolutely nothing whatever to do with formatting, appearance, or the actual text or data content of your documents, only the structure of them. If you want styling or formatting, see How do I control the formatting of XML?.]
XML provides a robust and durable format for information storage and transmission. Robust because it is based on a proven standard, and can thus be tested and verified; durable (persistent) because it uses plain-text file formats which will outlast proprietary binary ones.
XML provides a common syntax for messaging systems for the exchange of information between applications. Previously, each messaging system had its own format and all were different, which made inter-system messaging unnecessarily messy, complex, and expensive. If everyone uses the same syntax it makes writing these systems much faster and more reliable.
XML is free. Not just free of charge (free as in beer) but free of legal encumbrances (free as in speech). It doesn't belong to anyone, so it can't be hijacked or pirated. And you don't have to pay a fee to use it (you can of course choose to use commercial software to deal with it, for lots of good reasons, but you don't pay for XML itself).
XML information can be manipulated programmatically (under machine control), so XML documents can be pieced together from disparate sources, or taken apart and re-used in different ways. They can be converted into any other format with no loss of information.
XML lets you separate form (appearance) from content. Your XML file contains your document information (text, data) and identifies its structure: your formatting and other processing needs are identified separately in a stylesheet or processing system. The two are combined at output time to apply the required formatting to the text or data identified by its structure (location, position, rank, order, or whatever).
Any of the Design Goals listed in the XML Specification.
See also the list of reasons identified by Shlomi Fish in Why are you still using XML?.
Peter Flynn writes:
Why not just use Word or Notes?
Restricted proprietary data formats are unsuitable for durable public information.
Information on a network which connects many different types of computer has to be usable on all of them. Public information in particular cannot afford to be restricted to one make or model or manufacturer, or to cede control of its data format to private hands. It is also helpful for such information to be in a form that can be reused in many different ways, as this will minimise wasted time and effort. Proprietary data formats, no matter how well documented or publicised, are simply not an option: their control still resides in private hands and they can be changed or withdrawn arbitrarily without notice.
SGML is the international standard for defining this kind of application, and was therefore the natural choice for XML, but those who need an alternative based on different software for other purposes are entirely free to implement similar services using such a system, especially if they are for private use.