6 ms·
> The XML tag style is much, much easier to work with when you're dealing with markup. Having explicit end tags makes it harder to make well-formed documents t
by moron4hire 10y ago
> The XML tag style is much, much easier to work with when you're dealing with markup.
Having explicit end tags makes it harder to make well-formed documents that don't clash their closing tags.
Consider a very typical sort of HTML error:
<table>
<tr>
<td>
</tr>
</td>
</table>
Interleaving tags is never correct, yet XML allows us to do it (and I've seen it happen a lot).
The comparable S-Expr shows how it is just plain impossible to interleave tags:
(table
(tr
(td)))
You might ask yourself, "which close paren closes which list?" if the document were particularly gnarly. But if we're talking about particularly gnarly documents, then XML can be just as ambiguous. You'd be using a text editor that highlighted matching parens for you, at that point, just as much as you'd be using one that highlights matching close- and end-tags.
- mbrock 10y agoI've never had trouble with that.
- deleted 10y ago[deleted]
- vbezhenar 10y agoThis is not correct XML, parser will throw error. This is not correct HTML either. The only reason why this code is likely to produce good enough output in browser is that browser tries really hard to produce something readable even from complete garbage.
- mbrock 10y agoSuch interleavings can actually be valid HTML5, in that the specification defines an algorithm for parsing that handles such "tag soup" in a reasonable way.
- moron4hire 10y agoThat's not the same thing as making interleaving valid.
- mbrock 10y agoWhat's the difference?
- moron4hire 10y agoYes, I know it's not valid XML If you had read my post and not just skimmed the examples, you would have seen that was the point. XML's verbose end-tag feature makes it possible to make malformed documents in such a way that is just plain impossible with S-Expressions.