These days, I mostly use JSON, but XML is pretty much an ironclad data definition and transfer protocol. You can define and transfer just about any type of data, using it, albeit, in a rather “prolix” manner.
I suspect that may be why you might not have liked it. XML is not a good serialization of data for network protocols. XML is a good serialization of documents. Ok, that's the received wisdom that I'm echoing, but it's also my experience and my opinion.
When it comes to serialization of data for network protocols there are and have been many other better-suited schemes. XML got used as a serialization protocol for the the web because it's what existed at the time that was... close to HTML and textual, but it's got the disadvantage of being verbose.
Most XML parsers are structured to parse and deliver XML in element-delimited packets, in asynchronous fashion. I don't know of many JSON parsers that can do the same. They do exist (I use one, in the backend of one of my projects[0]), but they aren't as common. XML has packet/async built into OS SDKs, but JSON tends to be "The Whole Nine Yards" handling.
With Big Data/ML, I'm surprised that this is still a thing.
[Meaning stream parsing.] Yes, but typically one does not need that for small messages. I see that streaming decoders for Protocol Buffers is a thing now, but historically one does not bother with streaming for small messages, instead one streams lots of small messages.
> I don't know of many JSON parsers that can do the same.
libjq has one. With jsonlines or similar, if each text is small, there's no need for streamed decoding. Typically a DB query will produce a sequence of lots of small JSON texts, not one very large one.
If you're updating a DOM from XML then stream decoding makes sense, but in many cases streaming isn't ergonomic, just necessary when dealing with large documents (e.g., if there's not enough memory to hold them in memory without thrashing).
JSON can be a valid choice, as can XML, but I feel that the decision about which to use is too often based on fashion rather than choosing the best tool for the job. I wish this was different but there seems to be something structural in web development that favours the new over the proven, regardless of the circumstances.
People are starting to realize that most sites really boil down to parsing server state and rendering DOM. We never needed to do all this nonsense with serializing all state to JSON and shipping the entire rendering pipeline to the browser, that was just a heavy handed solution for a very specific scaling issue at Facebook.
Obviously JSON isn't well optimized either but I wonder how much, if any, progress might have been slowed by XML syntax clogging the pipes even more.
> how much, if any, progress might have been slowed by XML syntax clogging the pipes even more.
Depends what you mean by "progress", and if you think Web development has been improving or devolving over time.
[0]https://www.microsoft.com/en-us/research/publication/functio...
I.e., you can have XML and have it be compact by serializing it to something very close to ASN.1's PER (packed encoding rules).
Ditto for JSON, though there's lots of competing binary JSON schemes out there.
Maybe any time we create a new serialization scheme we should create an ETL for it.
Or maybe we shouldn't create new serialization schemes all the time. Here's just a few of them, and that's rather many: https://en.wikipedia.org/wiki/Comparison_of_data-serializati...
Maybe we should require licensure for creating new serialization schemes :)
Clearly you are not talking about the OOB experience here?
What customizations have you made? Something you can share?
Here’s me hoping I can move my MSBuild work to Emacs ;)
I dont recall getting schema-validation... ever.
If I recall correctly it probably just litters my nxml schema dir with whatever I happen to edit.
I believe it was an additional reason why comments were excluded from the JSON spec. I can't find the exact quote but Crockford's comment about excluding them for parser directive reasoning is pretty bang on considering usage of JSON primarily as an interchange format (and evidence of a good decision based on it's staying power).
https://web.archive.org/web/20190112173904/https://plus.goog...
I wouldn't call OPML a good example of XML for reasons I detail elsewhere in the thread. But if you need a subscription list of feeds for import or export it's alright.
It is moderately readable and writable, and the tooling is great. Whenever I have to write it Emacs verifies the doctype for me and handles the structural part of it.
And, as the document shows, xslt makes it easy as hell to scan the contents of a file.
OPML is a good example in my opinion. I used it maybe once a year and it has never failed me