JSON is everywhere these days. But XML still persists. How data exchange has “changed”
JSON has seen a lot of use lately, but what about XML? Both were meant to be a data exchange format; what is it about JSON that has made it the go to?
XML on the other hand is a markup language with a very simple base format with standards and interfacing languages. It is a bit more beefy and robust due to its formatting though. As a result, it is more verbose. It is also able to describe and analyze these text files, and store them in the XML file. However, XML provides the XML Schema that ensures type and structure so there is a more verbose validity for it. Especially in healthcare, it is verbose in that it can declare fields and type check. Because of the schema definition, the XML document has specific guidelines to be structured thus allowing validation for consistency and completion, splitting the responsibility from the code that processes the data.
In the diagram above, it indicates some of the limitations of JSON compared to the versatility of XML. In the Oracle post, it mentions that XML technologies support a complex ecosystem of semantics, particularly for interoperability, security, and rules. However, from what we know about the lightweight, human readable and quick JSON, it really is restricted to the structure and content capabilities. XML on the other hand is just more versatile in this case.
XML is better for presentation purpose. It is the language of several graphical user interfaces for now: XAML, XUL, MXML, etc., while QML is similar to JSON. In the first case, the data is stored in a form and used in another form. You can use XML from external sources and even make XML databases. Generalized. XML schema is useful for datatype and structure validation. Has other libraries like XSLT for transformation into different outputs. As well as XPath and XQuery for extraction of information, which can make parsing information in deeply nested structures more simple then with JSON. This makes it terrific for highly structured information that JSON simply does not support yet! In XML, you can add a child element or an attribute simple enough, namespaces can be used to prevent clashes (although that’s not much of a problem) and for the most part these extended attributes and elements don’t break due to the robustness of the structure.
In the end, I believe having a strong understanding of both is key to having clear and simple data exchange. It’s not too difficult to convert from XML to JSON, so depending on the project work in the best language for yourself and convert it as needed. Until JSON increases its verbosity and extensibility, the draconian XML APIs are here to stay and its important to be familiar of both concepts.