DEV Community

Cover image for Is XML Dead?
Dalbir Singh
Dalbir Singh

Posted on

2

Is XML Dead?

Today I was asked to provide technical consultation for a customer involving the generation of an XML document.

These days we developers play with JSON, but it is worth noting XML played some influence with JSON’s global adoption. You’ll often hear a lot talk about data models, sequences, markup and so forth in the JSON community – lessons that were learned from putting together XML standards.

<?xml version="1.0"?>
<catalog>
   <book id="bk101">
      <author>Gambardella, Matthew</author>
      <title>XML Developer's Guide</title>
      <genre>Computer</genre>
   </book>
   <book id="bk102">
      <author>Ralls, Kim</author>
      <title>Midnight Rain</title>
      <genre>Fantasy</genre>
      <price>5.95</price>
   </book>
</catalog>
Enter fullscreen mode Exit fullscreen mode

It’s been a while since I authored an XML document – I was reminded how the data structures are easier to read and understand. That’s not to say JSON isn’t readable, its just that with XML and it’s SGML derivatives the model is easier to comprehend, initially at least.

When I started thinking about how to parse XML documents again, It was then I was reminded why JSON is loved. While XML presents the data in an immediately readable format, JSON presents the data in an easily digestible format for your application code. No need, for complex XPath queries, just bind it to your internal model and your done!

If JSON is the preferred choice for data transfer within applications, does XML have anything left to offer?

Yes – documents…

XSLT

XSLT (eXtensible Stylesheet Language Transformations) is a language for transforming XML documents into other XML documents, or other formats such as HTML for web pages, plain text or XSL Formatting Objects, which may subsequently be converted to other formats, such as PDF, PostScript and PNG.

Alt Text

Example of XML/XSLT: In the image above you can see an example of XML and XSLT working together. The XSLT file uses XPath queries to lift information out of the XML document and render the content using templates. The output is shown below.

XML still works best for documents. Documents by their nature have a form of structure that is represented better through XML.

Combine XML with XSLT and you’re able to perform impressive transformations with nothing more than .xml and .xsl files.

So, Is XML Dead?

Not yet – XML still has its place for document-based structures. Also many financial institutions rely heavily on XML based formats for transferring information between enterprise systems that were built in the 2000s.

It’s well known financial enterprises such as Banks are reluctant to ‘upgrade’ their systems unless they really need to. So XML may not be the new kid on the block, and relegated to more mundane infrastructure but it’s still alive and kicking. 🤓

What about you? - Do you still use XML day to day?

Image of Bright Data

Maintain Seamless Data Collection – No more rotating IPs or server bans.

Avoid detection with our dynamic IP solutions. Perfect for continuous data scraping without interruptions.

Avoid Detection

Top comments (1)

Collapse
 
yokotobe profile image
yokotobe

For all system I built, I chose JSON. But still need to consume XML from another.

Cloudinary image

Optimize, customize, deliver, manage and analyze your images.

Remove background in all your web images at the same time, use outpainting to expand images with matching content, remove objects via open-set object detection and fill, recolor, crop, resize... Discover these and hundreds more ways to manage your web images and videos on a scale.

Learn more

👋 Kindness is contagious

Explore a sea of insights with this enlightening post, highly esteemed within the nurturing DEV Community. Coders of all stripes are invited to participate and contribute to our shared knowledge.

Expressing gratitude with a simple "thank you" can make a big impact. Leave your thanks in the comments!

On DEV, exchanging ideas smooths our way and strengthens our community bonds. Found this useful? A quick note of thanks to the author can mean a lot.

Okay