I'm genuinely perplexed at that animosity towards XML. In that second link I'm unable to find any substantive problem other than that "XML endtags make it too verbose". That seems like a legitimate thing to worry about when considering serialization formats, but where is all the vitriol coming from?
Beyond basic usage, XML is pretty complex: schemas, namespaces, XSLT, XSD, DTD, XPath and XQuery.
There are plenty of good arguments for the XML way of doing things. For example, having a rigorously defined way (XSLT) to specify transformations of schema-conforming XML is more robust than ad-hoc code that wrangles schemaless JSON.
But it does go against the hacker ethos and stands in the way of rapid development. And wherever it is used, complexity and verbosity seem to often follow. Look at SOAP, for example.
Yes. As a tree structure, basic xml is fine. There are lots of other ways to do it, but there's really not much difference. For communication, agreement on a common language is more important than its intrinsic merits. (and xml partly attained that because it looks like html, which was still new at the time).
But the xml ecosystem is horrible. Sensible ideas, horrific execution; like namespaces and schema. Probably the single worst problem was using xml syntax itself: it's like, a programming language that uses JSON for its syntax.
But also, there's guilt-by-association, people hate the enterprise culture that uses xml - similar happened to java.
Though xpath is not so bad, and many people seem to quite like it.
Finally... json is a better match for data, basically by being c-like. However, an ecosystem tumour is also growing, around JSON. Some even use json syntax itself...
I wonder, if perhaps, a root issue is that the world is complex, and youthful simplicity is corrupted as it adapts to cope with the real world...
There is hope, however; tools like `jq` never existed for xml.
JSON and XML aren't really equivalent though. XML is a markup language, JSON is a data serialization format. Of course a lot of hate for XML comes from people trying to use it to serialize data, which it can do but only in a clunky way. JSON is just plain better suited for what most people need.
Thank you (and @marcoperaza) for unpacking things a bit. I was mostly unaware of the sideband technologies that go along with the basic tag and attribute structure, and your comments about the community and "guilt by association" got me thinking about library support and other practicalities which I hadn't been considering. Thanks :)
This also got me reading up on various structured-data formats: XML, YAML, JSON, TOML, HCL, etc. I'd really like some big table comparing various features but can't seem to find anything of the sort.
I found a link [0] that has comparisons between JSON, TOML and YAML representations for various types of data. It's neat to see how each becomes more or less verbose depending on the kind of data getting encoded.
JSON should only really be used in a machine-to-machine context i.e. for serialization. If you want something that's easily editable with a text-editor then use YAML. XML is horrible for hand-editing, but is easier to read than either YAML or JSON and is super flexible, and has heaps of support in terms of tooling and libraries, and is well understood, so it's great for information interchange. Issues around verbosity aren't a huge issue for machines and again this verbosity is actually helpful when doing data-integration. Concerns about wasting space are spurious since any redundancy in data can easily be done away with with some basic data compression, and as somebody else mentioned, xpath is actually pretty good, and makes the verbosity actually a net positive for certain applications.
I think `jq` is more powerful, but for those afflicted with xml instead of json, there is `xmllint`. In a pinch, one can use it to hack something together (along with xpath and xslt).
XML is fine if all you want is a human-readable format to define tree data structures such as documents to be used in applications where only strings are used and someone within the use case needs to have the semantics of each node and each attribute spelled out quite clearly and unequivocally in the document structure itself.
For any other case, XML is horrible.
Now, consider that XML is used quite extensively in any other case beyond tree-based DOM data structures that it was designed for.
The first one claims (without giving a source) that James Clark once said or wrote:
“Any damn fool could produce a better data format than XML” – James Clark 2007-04-06
[1] http://harmful.cat-v.org/software/xml/
[2] http://harmful.cat-v.org/software/xml/s-exp_vs_XML