Live data from Hacker News

The lost art of XML

marcosmagueta.com

91–100 of 179 posts

Re: The lost art of XML

#91

XML was designed for documents; JSON for data structures. The 'lost art' framing implies we forgot something valuable, but what actually happened is we stopped using a document format for data serialization. That's not forgetting - that's learning. XML is still the right choice for its original domain (markup, documents with mixed content). It was never the right choice for API payloads and config files.

> XML was designed for documents; JSON for data structures. JSON wasn't even designed for anything. It's literally the necessary and sufficient part of JavaScript that you could pass to an eval() to get a data structure out. It required zero tooling and even third-party module to hit the ground running.

[dead]

Re: The lost art of XML

#93

The fundamental reason JSON won over XML is that JSON maps exactly to universal data structures (lists and string-keyed maps) and XML does not.

This article/blog post [1] has been on HN several times before, but it is well worth a reminder.

[1] https://seriot.ch/software/parsing_json.html

Re: The lost art of XML

#94

Earlier quoted context omitted.

>REST by definition is used nowhere at all There exist plenty of people actually using REST. It can reduce complexity of SPAs.

Name one application which uses HATEOAS.

I have built a few. And of course there’s a lot of interest in the community around various HATEOAS specs. People build with HAL, Siren, JSON:LD etc.

Re: The lost art of XML

#95

Earlier quoted context omitted.

if bandwidth was a concern, JSON was a poor solution. XML compresses nicely and efficiently. Yes it can be verbose to the human eyes, but I don't know if bandwidth is the reason it's not used more often.

JSON absolutely isn't perfect, but it's a spec that you can explain in ~5 minutes, mirrors common PL syntax for Dict/Array, and is pretty much superior to XML in every way.

Sure, but the argument is bandwidth which is what I’m comparing them to solutions to each other against.

Re: The lost art of XML

#96
This is a better article than other recent ones on XML vs JSON. "The S-Expression Connection" is something that resonates having been in the .NET space where Don Box was active and whole bunch of web services things (good and bad) overlapped.

Re: The lost art of XML

#97

Earlier quoted context omitted.

You have to use the right tool for the job. XML is extensible markup, i.e. it's like HTML that can be applied to tasks outside of representing web pages. It's designed to be written by hand. It has comments! A good use for XML would be declaring a native UI: it's not HTML but it's like HTML. JSON is a plain text serialization format. It's designed to be generated and consumed by computers whilst being readable by hum…

> It's designed to be written by hand Are you sure about that? I've heard XML gurus say the exact opposite. This is a very good example of why I detest the phrase “use the right tool for the job.” People say this as an appeal to reason, as if there weren't an obvious follow-up question that different people might answer very differently.

Perfectly sure. XML is eXtensible Markup Language, the generalized counterpart to Hypertext Markup Language.

XML, HTML, SGML are all designed to be written by hand.

You can generate XML, just like you can generate HTML, but the language wasn't designed to make that easy.

Computers don't need comments, matching tags, or whitespace stripping.

There was a time, in the early-mid 2000s when XML was the hammer for every screw. But then JSON was invented and it took over most of those use cases. Perhaps those XML gurus are stuck in a time warp.

XML remains a good way to represent tree structures that need to be human editable.

Re: The lost art of XML

#98

XML was designed for documents; JSON for data structures. The 'lost art' framing implies we forgot something valuable, but what actually happened is we stopped using a document format for data serialization. That's not forgetting - that's learning. XML is still the right choice for its original domain (markup, documents with mixed content). It was never the right choice for API payloads and config files.

I think XML for documents lost to markdown. Between markdown and HTML, there is no need for XML in that domain anymore either.

[deleted]

Re: The lost art of XML

#99

Smells like an article from someone that didn’t really USE the XML ecosystem. First, there is modeling ambiguity, too many ways to represent the same data structure. Which means you can’t parse into native structs but instead into a heavy DOM object and it sucks to interact with it. Then, schemas sound great, until you run into DTD, XSD, and RelaxNG. Relax only exists because XSD is pretty much incomprehensible. Then…

I read the article and my first thought was it was entirely missing the complexity of XML. It started out relatively simple and easy to understand and most people/programs wrote simple XML that looked a lot like HTML still does. But it didn't take long before XML might well be a binary format for all it matters to us humans looking at it, parsing it, dealing with it. JSON came along and it's simplicity was baked in.…

> It started out relatively simple and easy to understand ....

when the specs for a data representation format evolved with XML bombs abilities, it has gone too far in trying to please everyone, and that is probably why JSON won in the long run, it's not perfect but stable and simple without crazy issues you have to worry about when parsing it. If XML had a Torvaldish kind of dictator who can afford to say no, I doubt JSON would have won

Re: The lost art of XML

#100
Its really bizarre, you talk about Rust or TypeScript and everyone understands how doing a little bit extra planning up front yields to great results as everyone can work from solid foundations, but you suggest they do the same for your data by using XML and its wailing and gnashing of teeth, bringing up anecdotes about SOAP and DTDs like we're all still living in 2003, concatenating strings together for our XML and trying to find answers to problems on forums or on ExpertSexChange.

The vast, vast majority of devs today have never known anything except JSON for their React frontends, but honestly if they gave XML a try and weren't working from second hand horror stories from 20 years ago I think a lot more people would like it than you expect.

Post reply on HN