HACKER Q&A
📣 stevefan1999

Why did XML failed to be the standard for data format?


I mean, most of anything that somewhat touches XML had failed miserably [1]. SOAP, XMPP, and to a certain extent, XAML on WPF/Xamarin is also a failure; it seems like to me that JSON is the lingua franca of the data format world despite that JSON was lacking in some useful stuff (e.g. a schema system), what makes it that XML has met its disappearence.

[1]: Yes, I know HTML is also a derivative in the family of XML/SGML, yet don't most of you frontend devs think that HTML sucks too?


  👤 rs23296008n1 Accepted Answer ✓
Every xml file I've ever encountered was broken in some way or malformed compared to its schema. Manual adjustment was nearly always required in some way. (Yet they had schemas and full descriptions) JSON files come in all sizes and complexity but typically work better. Much easier to read/write using automated tools. XML is far too complex to read with simple parsers in a performant way especially when compared to JSON.

For data transfer now I'd actually prefer csv over xml due to the simple fact I can at least sanitise it. That is how low my opinion has gotten over years of data migration projects. In my new work I primarily work on JSON / csv / tsv and would not even consider xml. XML schemas have the idea of keeping data clean etc as well as guiding parsers etc but the added functionality comes at a price in performance and parsing complexity. I did find the xml transformation abilities useful however.

My personal opinions aside, friends of mine using java still swear by xml so if you're from that crowd your opinion might differ. I'm guessing the java infrastructure is more forgiving but its been too long for me to assume more than that. They obviously find utility in it: terabytes of xml is not trivial by any stretch of the imagination.


👤 mattbillenstein
xml is too complicated and too easy to get wrong - try consuming rss feeds and the amount of malformed xml you'll find is astounding - people basically template xml, so you'll get just bad syntax and text encoding problems.

json avoids these pitfalls and people mostly just use a lib to generate it from native data structures, so it's almost always well-formed.