4 ms·
The XML tag style is much, much easier to work with when you're dealing with markup. And XML's purpose is to be an Extensible Markup Language. It's way more app
by mbrock 10y ago
The XML tag style is much, much easier to work with when you're dealing with markup. And XML's purpose is to be an Extensible Markup Language. It's way more appropriate than JSON or S-expressions for that.
(Do you prefer to write HTML documents as S-expressions?)
- kccqzy 10y agoYes. With good tooling (such as Emacs), markup is much more pleasant to write in S-expressions than XML.
- wtbob 10y ago> Do you prefer to write HTML documents as S-expressions? Actually, yes. I use CL-WHO[1] a lot, in which one can write: (:html (:head (:title "Foo bar") (:link :rel "stylesheet" :href="baz.css")) (:body (:p "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum ullamcorper efficitur purus, at suscipit nunc luctus vitae.") (:ol (:li "Cras vel est accumsan, malesuada leo eu, iaculis nulla.") (:li "Proin nec mi feugiat, posuere enim in, vehicula erat.") (:li "Morbi vitae purus nec neque posuere pharetra ultricies in nibh.") (:li "Nam maximus lectus faucibus, ullamcorper lectus aliquam, aliquam lectus.")))) Which I contend is prettier than the equivalent HTML. [1] http://weitz.de/cl-who/ http://weitz.de/cl-who/
- mbrock 10y agoI like S-expressions too, especially when generating markup programmatically. For hand-writing HTML/XML documents, which I do quite a lot, I really enjoy the tag style because of the verbose end tags and the ease of moving blocks. It's at least nice enough to make me annoyed when people claim the tag syntax is some horrible stupid disaster compared to S-expressions or (worse) JSON.
- wtbob 10y ago> For hand-writing HTML/XML documents, which I do quite a lot, I really enjoy the tag style because of the verbose end tags and the ease of moving blocks. I can't say anything about liking verbose tags, which seems to me a matter of taste, but moving around S-expression blocks is easy: C-SPC to set the point, M-C-f to move forward one S-expression, C-w to cut the current region, navigate to where one wants it, C-y to yank the cut region. Granted, this is using emacs, which really had better have good S-expression-editing capabilities after 40 years!
- mbrock 10y agoI also quite like Dylan's way of ending blocks, letting you type for example "end method do-stuff" so you can see clearly what's being ended, which is useful in a document with long sections. And I like that XML block moving is even manageable with ed, which I actually use sometimes. Well, and vi.
- 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.