5 ms·
Closed as subjective and argumentative. Darn, I wanted to pick a fight there. ;) Many of the really crappy aspects of XML have been thoroughly abstracted away
by crux_ 16y ago
Closed as subjective and argumentative. Darn, I wanted to pick a fight there. ;)
Many of the really crappy aspects of XML have been thoroughly abstracted away by libraries. I'm of the opinion that you can only truly despise XML if you've tried to write a parser for it yourself.
Examples of the issues: It requires arbitrary lookahead & backtracking. There is no canonical document encoding. (Support arbitrary character encoding for content: great idea! Support arbitrary encoding for the metadata/XML itself: The opposite of a great idea.) Entity references: need I say more?
There's a reason this sort of thing keeps coming up: http://voices.washingtonpost.com/securityfix/2009/08/researchers_xml_security_flaw.html http://voices.washingtonpost.com/securityfix/2009/08/researc...
XML as it would be in an ideal world would be (a) simple and (b) unambiguous; it fails both.
All that said, there's a huge benefit in the whole world arriving at a somewhat standard way of doing things, and a lot of that benefit remains even if the standard itself really sucks.
- masklinn 16y ago> I'm of the opinion that you can only truly despise XML if you've tried to write a parser for it yourself. Or had to work with any of the utterly terrible xml dialects out there, which represents about 90% of them first and foremost xslt and xsd. Or had to deal with the various bugs in parsers, or with most people's (and software's) complete and utter inability to correctly deal with xml namespaces.
- crux_ 16y agoStrictly speaking, XML could be extremely well done and still have horrible horrible things done with it higher up in the layer cake. ;) There's no surprise, though, that a shoddy foundation might encourage crappy houses.
- sofuture 16y agoXML isn't bad in and of itself. It's just a powerful, neutral format. The problem with XML is that it allows so much abuse. I had to interface with a government system at some point. They shipped us a whole schema of custom elements such as "IsShipment" (for example) which extended bool to allow extra options. All this was clearly documented in the schema comments "You can use 'true', 'false', 'sortof', and 'mostly'." So we go to validate the data.... and it doesn't validate. Against their schema. Because they didn't extend bool, they just said they did in the comments. When we got back in touch with them, we realized that they had no clue that the stuff not in comments mattered. As far as they knew, XML was just text, and they had clearly specified how it was to be interpreted (in English).
- 10ren 16y agoYou make me wonder if the hate is partly due to XML being used in integration, and integration is difficult and problematic, and vulnerable to all kinds of communication problems. And if JSON tends to be used where integration isn't very challenging (eg. you control both ends, and the data is fairly regular and simple; or one end is entirely determined by the other); that is, where schemas aren't needed.
- crux_ 16y ago> XML isn't bad in and of itself. I'm arguing that it is. Symptoms of badness: version 1.0 of the basic standard is on its 5th edition over ~8 years. Said standard is stupendously huge. Major security/crash & other bugs in pretty much every parser (https://www.cert.fi/en/reports/2009/vulnerability2009085.html https://www.cert.fi/en/reports/2009/vulnerability2009085.htm...) as of less than a year ago. XHTML's abandonment. In short, XML stinks and there's plenty of evidence out there that it does. Please note that doesn't mean I would wish XML away. Widespread adoption, in and of itself, is a killer feature.
- 10ren 16y agoCould you explain the arbitrary lookahead and backtracking please? I thought UPA (unambiguous particle attribution - or "deterministic" for DTDs) avoided the need for backtracking... Or is it to do with entity references? I've found it simple to write XML parsers, but that's for a common (defacto?) subset, not the full spec.
- crux_ 16y agoNote that I was talking about parsing a stream of text into a DOM tree or SAX events, not parsing a DOM tree or SAX events into some second-order structure. Lookahead: Your parser will need to read the entirety of a tag (from the '<' to the '>' or '/>') to know whether it is a start tag or a complete tag. I think my use of the word backtracking was a wee bit sloppy, although the above situation may cause it in some types of LL() parsers. http://www.antlr.org/wiki/display/ANTLR3/3.+LL%28*%29+Parsing+%28Excursion%29 http://www.antlr.org/wiki/display/ANTLR3/3.+LL%28*%29+Parsin... (Another parsing gotcha: XML isn't even context free, since the start and end tags must match and, for a general parser, there's an infinite number of possible tags.)
- 10ren 16y agoOK, thanks, I see what you mean.