What is XML?
XML is an acronym for eXtensible Markup Language. Its primary purpose is to allow the exchange of text between disparate applications while still being readable to humans.
What problem does XML solve?
If you've ever tried to exchange a nicely typed and formatted document between Microsoft Word and another text program, you probably ended up with a mess of unformatted text globules. Frustrating, right? Text is formatted behind-the-scenes with tags, and different programs use different tags to present text, and sometimes require proprietary software. This became a big problem as the Internet grew, because sites were trying to exchange data with HTTP, but programmers had to spend time changing tags to fit different applications. It was kind of like everybody in the world wanted to work together on this amazing new Internet thing, but everyone spoke a different language with its own grammar and syntax. XML was built to solve this exact problem; in the W3C's words, their goal was "making the internet more usable".
What does XML actually do?
Nothing! XML does nothing. It dispenses with the proprietary and arcane formats that were breaking the Internet as companies jostled for position, and offered plain, self-descriptive text, with the ability to structure and define your own data. While XML doesn’t actually do anything, it may be as fundamental to the web as HTML. XML is also extensible, which means when a system is upgraded, or an old document is read by new software, it still works! Sometimes, simplicity really is the greatest form of complexity.
What is the difference between HTTP and XML?
HTTP is used primarily for _presenting data_, while XML is for exchanging data in a way any program can read. HTTP uses predefined tags, meaning you know `<p>` is starting a para tag, and always will. XML has no predefined tags, which means the author defines and structures the data within as they see fit. This was part of the reason for XML's great success. Different industries could build their own standards with XML (in Document Type Definition, or `.dtd` format), but data within these structures still worked outside of the environment.
What is the difference between JSON and XML?
JSON stands for JavaScript Object Notation, and is an alternative to XML. JSON is more lightweight than XML, so it's a more efficient method of on-demand data exchange.
How can I use XML?
Use XML to store data decoupled from its formatting. Below is an example from W3C's [Introduction to XML](https://www.w3schools.com/XML/default.asp) that displays an XML document. The `note` tag contains the elements `to`, `from`, `heading` and `body`. These are all user-defined tags that will behave consistently, even if they're being processed by JavaScript and delivered with HTTP.
<?xml version="1.0" encoding="UTF-8"?>
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
Conclusion
To continue learning about XML, continue with the excellent course at [W3C](https://www.w3schools.com/XML/default.asp), the Web consortium that initially helped create XML. The course will have you understanding and writing XML syntax in no time. From there, check out AJAX (Asynchronous JavaScript And XML) to get into more JSON-like functions using XML.
Frequently Asked Questions
What is XML?
XML stands for eXtensible Markup Language. It is a markup language designed to make data exchange between different applications easier while staying human-readable, providing a standardized, self-descriptive format that works across platforms.
How does XML work?
XML structures data using tags that you define yourself, wrapping each piece of information in opening and closing tags. A document usually starts with a declaration such as <?xml version="1.0" encoding="UTF-8"?> and then nests elements, so a note might contain <to>, <from>, <heading>, and <body> tags that describe their own contents.
What is the difference between XML and HTML?
HTML uses predefined tags, so a tag like <p> always means the same thing and starts a paragraph. XML has no predefined tags, which lets you create your own tags to describe your data instead of formatting it for display.
What is the difference between XML and JSON?
Both XML and JSON are formats for exchanging structured data, but JSON is more lightweight than XML. That makes JSON a more efficient method for on-demand data exchange.
Why does XML matter?
XML solves the problem of incompatible data formats by decoupling data from formatting and giving systems a standardized, self-descriptive way to share information. It was fundamental to making the internet functional, letting different systems exchange structured data reliably across platforms and industries.
What does it mean that XML is extensible?
Being extensible means you can add new tags and structures over time without breaking compatibility with older documents. Systems can be upgraded while still reading data written in earlier versions.


