XML: Extensible Markup Language

Jhonny Chamoun
3 min readOct 2, 2020

All of you by now are familiar with JSON, the text-based format we are using to store and transfer data through the internet. JSON was standardized in 2013, four years after I landed my first job as a full-stack developer.

What did we use before JSON!?

XML is a markup language, similar to HTML its purpose is to define a set of rules about the data it holds, give meaning.

The design goals of XML emphasize simplicity, generality, and usability across the Internet. It is a textual data format with strong support via Unicode for different human languages. Although the design of XML focuses on documents, the language is widely used for the representation of arbitrary data structures such as those used in web services.

While Both XML and JSON are designed to store and transfer data, and while both of them focus on being both human and machine-readable, they still found a way to be very different.
both of them can be parsed and converted using different programming languages and both work well with AJAX…

So What’s the big deal!? why all this fuss!?

Essentially, JSON is simpler to understand, at least by human standards, and has a smaller payload compared to XML for the same amount of data. Some studies even suggest that the same amount of data can take up to 20% more time to transfer in XML…

So Why are we even talking about XML? shouldn’t it be forgotten in the past already?

Well because XML is more structured; it has more powerful features like the ability to query it directly, design your own dialects of the format, and even design your own data types. Actually, XML has built its own ecosystem.

In the example to the left, you can see how the same amount of data can take a lot more space both physically and in memory to be presented in XML than in JSON…

But this extensive way of marking up the data comes with benefits.

JSON is great for simple use cases, as the transfer of data, but XML allows us to do more advanced tasks.

XML comes with a querying language called XQuery that uses XPath to traverse the XML document structure and retrieve the needed data, you can read more about it at the following link.

XML can be coupled with XSLT to be styled into HTML, ,XHTML, or SVG. However, XSLT is used for a wide range of transformation tasks, not exclusively for formatting and presentation applications. you can also read more about it in the W3 documentation.

XML can also be coupled with a DTD (Document Type Definition) or XSD (XML schema definition) that allows enforcing a specific structure for the XML document and legal elements. All about XML validation in the following link.

Finally, I hope I helped shed some light on a topic that some people might think is not relevant anymore, but out there in the world of software engineering, one might face a problem that exceeds what JSON can offer, and I for sure I will appreciate having some guides I can follow.

--

--

Jhonny Chamoun

Software Engineer, Problem solving oriented and new technologies enthusiast.