Glossary
Last Updated Jul 02, 2021

XML

Emma Jagger

Table of Contents:

Get your free
API key now
4.8 from 1,863 votes
See why the best developers build on Abstract
START FOR FREE
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
No credit card required

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.

Get your free
API
key now
4.8 from 1,863 votes
See why the best developers build on Abstract
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
No credit card required