News for hackers. Stuff that matters.
Re:How to Avoid Being Called a Bozo When Producing XML (2005) by moron4hire on Sunday July 31, 2016 @05:05PM (#12198856)
> 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.
Re:How to Avoid Being Called a Bozo When Producing XML (2005) by vbezhenar on Monday August 01, 2016 @04:25AM (#12200889)
This 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.
Re:How to Avoid Being Called a Bozo When Producing XML (2005) by moron4hire on Monday August 01, 2016 @06:31AM (#12201316)
Yes, 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.
Re:How to Avoid Being Called a Bozo When Producing XML (2005) by mbrock on Monday August 01, 2016 @04:29AM (#12200906)
Such interleavings can actually be valid HTML5, in that the specification defines an algorithm for parsing that handles such "tag soup" in a reasonable way.
Re:How to Avoid Being Called a Bozo When Producing XML (2005) by moron4hire on Monday August 01, 2016 @06:35AM (#12201329)
That's not the same thing as making interleaving valid.
Re:How to Avoid Being Called a Bozo When Producing XML (2005) by mbrock on Monday August 01, 2016 @07:16AM (#12201522)
What's the difference?
Re:How to Avoid Being Called a Bozo When Producing XML (2005) by mbrock on Monday August 01, 2016 @03:57AM (#12200806)
I've never had trouble with that.