4 ms·
Every time XML comes up, I feel obligated to share my opinion (I too wrote XML a the turn of the millennium and have seen it become and still witness on occasio
by hackrmn 3mo ago
Every time XML comes up, I feel obligated to share my opinion (I too wrote XML a the turn of the millennium and have seen it become and still witness on occasion it being excommunicated).
XML is verbose and therefore uglier than it ought to be. I think most of the haters hate it for that alone -- there's not much else to hate because you don't have to deal with the rest, it's not really imposed on you unless you really have to deal with someone else's XML application.
What do I mean? Well, the brackets thing and the necessity to repeat name of every element twice, in correct (LIFO, last in first out) order, isn't great, admittedly.
What XML has that the dev-bro alternatives that have flooded the void XML left since, haven't gotten and thus see being reinvented, are: namespaces, attributes and interop using the former two. Sure you can write JSON and YAML (the latter deservingly being incredibly hard to parse correctly -- they tried to design a better XML but failed IMO) -- but these suck as meta-languages because there's not much "meta" there. JSON, for example, allows you create properties and has a few types (kind of more than XML, really) but it leaves semantics up to you and namespaces are up to you to re-invent, poorly. If you think I am stretching the argument, see if you can represent an HTML document (no, not Markdown) with a JSON file.
YAML is a similar story, albeit with a few cool things like aliases. I think it's a better attempt to give the world a better XML, but the jury is still out on that one.
The killer thing with XML, for better and for worse, was plethora of tools to work with it. I wrote a fair share of XSLT documents to transform data, back when there was momentum in XHTML, for example. XSLT barely supports JSON and it's not pretty. XPath cannot natively understand YAML -- unless you convert it to XML which I guess re-animates XML as some sort of Frankenstein's monster. And even if it were a [pretty] monster, dealing with intermediate representation for the kind of purpose, is a can of worms all of its own.
Ironically nobody seems to hate HTML 5, seemingly. Or React basically turned it into a greasy cogwheel nobody needs to look at. Because if you look at it, it's in my opinion an abomination even compared to XML (unpopular opinion) -- the parser is quirky and behaviour is defined by the standard per element type (i.e. some elements need a closing tag and some do not, and what happens if you forget a closing tag is element-specific; care to remember the set of rules to ensure your document renders to your liking?). It has no namespaces but it has "custom elements" which require a dash in the name as poor' man's namespaces and you can't omit one, and now we have a Web of `x-spinner` and `x-carousel` because it turns out everyone rightfully wanted default namespace but didn't get one. Anyway, it's all plumbing, right -- the idea of _writing_ HTML has largely come and gone us by. And I am digressing.
- int_19h 3mo agoI don't like HTML5 and to this day I don't understand what was actually gained by dropping XHTML.
- tommica 3mo agoNot having the page break because of a small mistake. Though I did get pretty good at writing XHTML, and strictness is a blessing in certain cases.
- int_19h 3mo agoFail fast is a feature, not a bug. It's much better to get clear and actionable feedback rather than the page silently rendering incorrectly in some subtle manner.
- kccqzy 3mo agoXHTML was dropped because it wasn’t backwards compatible, and it was too strict in its syntax. Minor syntax errors that could be automatically corrected by the browser turned into full page errors.
- notnullorvoid 3mo agoMeanwhile valid XHTML like having custom elements as table children, in HTML gets silently "corrected" to an malformed document. I'd much rather have the stricter syntax parsing of XML, vs the complex and outdated structural correction rules of HTML.
- hackrmn 3mo agoI think this is _the_ most popular criticism of HTML 5 vs. XML, that I have seen mentioned. Which is telling, quite frankly. It makes me think that the powers that be that pushed HTML 5 really had a different agenda than what they purported to have. We might never know the politics behind it, but I struggle to comprehend the wisdom of a decision to basically overhaul the lingua de franca of the Web because "XML parsing is hard!" then replacing it with HTML 5 and its peculiar "context sensitive grammar" noone ever remembers or bothers to look up, and the other features like custom elements (with the latter, by the way, in the spirit of "let's just ship it and see", they kind of foundered with the sub-classing there -- Apple rightfully refuses to implement some of Custom Elements API because it flies in the face of Liskov's Substitution Principle).