In My Limited Experience: Why XML?

Before becoming familiar with XML – I recognized it as a convenient language when dealing with web content that has been archived or needed to be imported and exported easily. One of the platforms I used was Blogger (which is now owned by Google). When Blogger/Blogspot was in its beginning it kept blog posts in Extensible Markup Language (XML) and used it in conjunction with either HTML or PHP. The language is still very popular and almost every browser/web-parsing medium is capable of handing XML. Most of this popularity is due to it’s similarity and integration with HTML. From the outside, the language seems simple and is understandable to the average inexperienced person.  I come from a background where I had used exclusively JSON which refers to itself as “The Fat-free XML Alternative”.

Just from looking at two pieces of XML and JSON code that represent the same data – it is obvious that XML is more verbose and contains far more than needed to handle a simple string. JSON is also a map which consists of keys and value rather than a tree. Trees figuratively branch out farther and can be harder to understand. Yes, a key and value (mapping structure) can be somewhat limited in what it can achieve but simplicity is also important. Personally, the structure of JSON is easier when you’re coding in an object oriented language. One can go from the objects in JSON to objects in their Java program because they align.

It’s not only human parsing that is drastically better but also JSON tends to be faster because XML manipulation libraries tend to be large and take up far more memory as they parse larger verbose XML files.

I am currently developing an app with Firebase as my backend and almost all the developers that praise Firebase’s simplicity compare it JSON. It is somewhat limiting to have a key/value structure but the alternative is less intuitive and not as stylistically pleasing. The transportation of data is largely the focus of both XML and JSON – both in terms of separating styling (HTML/CSS) and data (like blog posts) or simply maintaining DTDs and standard schemas in a data processing/transferring situation

I personally think that JSON and languages like YAML are going to become the norm but this will take a good amount of time due to the wide integration of XML in various industries. XML is a platform for a large amount of retail, finance and other B2B data transfer systems.

Simplicity and effectiveness is directly correlated to success. The easier it is for a human to parse something – in this case XML/JSON/YAML/etc. – the more likely it will be received. I think in many ways financial standards such as MIFID and XBRL which are based on XML will soon adopt other simpler language will different data structures.

In the meantime – XML is highly beneficial to learn.


References and further reading:

By | 2018-04-03T21:57:30+00:00 March 12th, 2018|0 Comments