Just like YAML, there exist a sound subset of XML that is quite usable. Just like YAML, XML is hard to write correctly, but I would say the XML errors are much easier to spot.
Both JSON and YAML have the problem of lacking tagged unions. Also, the XML data definition can be either extra complexity or a great tool depending on your usage. (But DTDs use an atrocious language either way.) None of those 3 standards have a really universal type representation, and while there are substandards for XML that extend the types, I've never seen anything that could encode even the C type system.
As the OP said, the quest for the perfect data language is still on.
The "O" in TOML is not deserved in my opinion.
I also find TOML to be much a cleaner syntax than either of the two, but maybe we should just give up and make a JSON-C (for Configuration, I just made this) which supports comments.
One can usually answer the question "am I going to frequently have deeply-nested tables and/or long strings for keys" in advance, and if the answer is no then TOML is practically ideal. If it proves to be wrong occasionally than JSON is a reasonable fallback, as is just coping with the verbosity of TOML.
This isn't a snipe at YAML specifically. It's a repeated pattern I've seen with many technologies. There's a certain mode of advocacy you can use to invoke this on a certain set of the programmer population, and it works reasonably often.
(The "better than the X you all hate!" part may be obligatory; I haven't studied this in a careful academic sense, I've just observed this pattern a few times. Leveraging an emotional reaction against some tech and using it to suppress a rational examination of the proposed replacement on its own terms may be the mechanism of how this is done.)
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE greeting [
<!ELEMENT greeting (#PCDATA)>
]>
<greeting>Hello, world!</greeting>
The first example of a complete, self-contained yaml document in the yaml spec looks like this: # Ranking of 1998 home runs
---
- Mark McGwire
- Sammy Sosa
- Ken Griffey
# Team ranking
---
- Chicago Cubs
- St Louis Cardinals
I think that is quite representative of the user experience as a whole: Yes, there are a ton of dark corners in Yaml that only a tiny fraction of people truly understand, but the default user experience feels just like writing a slightly more convenient JSON, whereas XML by default is a garbled mess.It’s clearly not perfect but IMO it’s the best right now.
Because we want a low-noise human configuration language.
XML and JSON certainly aren't it.
TOML and HOCON are low-noise, but share many of YAML's drawbacks.
What are the types in the following YAML document?
a: true
b: on
c: yes
d: TrUE
e: aye
It's as if the designers craved inconsistency.Poor Norway.
https://hitchdev.com/strictyaml/why/implicit-typing-removed/
So do I. XML is sane and has a lot of tooling readily available.
YAML, with its significant white space, is one of the shittiest formats that I have ever encountered.
comments. trailing commas
https://nigeltao.github.io/blog/2021/json-with-commas-commen...