Anne van Kesteren

XHTML because it has a DOCTYPE

It seems people are just using XHTML because it has a “stricter” DOCTYPE than HTML. (They are also quoting inferior notes from the W3C.) I personally believe that’s a terminology confusion as it’s not stricter, it just has fewer exceptions to the basic set of rules. Also, the W3C uses strict to denote the allowed set of elements for a particular DOCTYPE, nowhere it uses it to symbolize the rules for optional end tags, et cetera or XML based parsing.

People don’t really like the draconian error handling, it’s bad for business as they know you can’t guarantee being well-formed on sites. Well, not today. Especially not on larger sites that aren’t based on an XML backend but on some string based template system with a crappy CMS.

If the DOCTYPE is the only advantage — not that DOCTYPEs matter — why not use a ‘stricter’ HTML 4.01 Strict DTD?

Comments

  1. Oh and why is the blog in HTML 4.01 and the comments still asking for XHTML, Anne...?

    Posted by BOK at

  2. "People don’t really like the draconian error handling"

    That's a big generalisation, Anne. I for one like it a lot.

    Posted by Hayo Bethlehem at

  3. @1, if I'm not mistaken it's like transformed to minimalistic HTML 4.01 on the fly while generating the page and is in the backend as XHTML.

    Posted by Frenzie at

  4. Psychological factor. Also, stricter syntax - it's bull to say that it's not really stricter, because it is stricter. The XML syntax is simply a strict syntax whereas SGML is an inherently non-strict syntax.

    Posted by Faruk Ateş at

  5. I'm perfectly happy with XHTML, knowing that sometime in the future it will probably be the norm, parsed correctly in all browsers.

    Who cares if most of the population is actually viewing a html document because their browser is so crap? They don't.

    Posted by The Wolf at

  6. Indeed, as BOK said, why if HTML is so nice use XHTML in your comments?

    From a programmers view it's quite simple:"It's easier to parse"!
    That is one of the reasons why I still write my pages in XHTML(with content negotiation) and not in HTML. It's still choosing beteen 2 bads, and I chose mine...

    Posted by Momos at

  7. Oh and why is the blog in HTML 4.01 and the comments still asking for XHTML, Anne...?

    Because Anne wants a weblog with a well-formed backend.

    Posted by Ryan at

  8. Doesn't "fewer exceptions to the basic set of rules" MEAN an increased sense of strictness???

    Posted by Jeff Schiller at

  9. I wouldn't mind a well-formed backend myself.

    Posted by Adam Taylor at

  10. I use XHTML because then any old XML parser (including XSLT processors) can grab my information and use it however they want to without me dictating a limitation or a needless complexity to the user.

    So, what you said, isn't the ONLY reason people are just using XHTML.

    Posted by Devon at

  11. And even if XHTML has a stricter DOCTYPE, does that really make much of a difference? Isn't the web really in worse shape because of all of the tagsoup?

    "Because HTML allowed that to happen", is what you'll say. That is true, but XHTML doesn't particularly get rid of tagsoup, either: You could easily make a valid XHTML document with nested tables for layout and CLASS attributes like gray-background and big-text. And sending XHTML as text/html doesn't make it conform to the strictness of XHTML, anyway.

    Just a few thoughts.

    Posted by Ryan at

  12. "That is true, but XHTML doesn't particularly get rid of tagsoup, either: You could easily make a valid XHTML document with nested tables for layout and CLASS attributes like gray-background and big-text."

    But that's not tag soup. It's (arguably, case-dependent) bad form.

    Posted by NotSoSure at

  13. BOK, because I love contradiction. Also, making it easier for people to comment might attract spammers and such. Not good.

    Hayo, me too. Just not client-side. (Client applies to potential visitors as well as the browser here.)

    Faruk, for all ‘bigger’ projects I have done so far there was no such thing as a psychological factor.

    Devon, you and your dog might have a different reason, but minorities don’t count for the moment. Also if you don’t run it through Tidy or so first your are fucked anyway.

    Posted by Anne at

  14. But that's not tag soup. It's (arguably, case-dependent) bad form.

    Ah, yes, thanks for the correction. As you said, though, it is bad form. And that is point I am trying to make (the key word being "bad"): If people can fudge things (and think it's okay), they will fudge things (and think it's okay). We need to be fighting for semantics and logical document structure. The lack of these qualities have made the web what it is today.

    Posted by Ryan at

  15. "People don’t really like the draconian error handling"

    That's a big generalisation, Anne. I for one like it a lot.

    Count me in on the draconian handling lovers.

    I prefer to build things as end-to-end XML toolchains, and then draconian handling is, IMHO, great. Of course, that part is in no real disagreement with Anne’s post.

    Posted by Aristotle Pagaltzis at

  16. Doesn't "fewer exceptions to the basic set of rules" MEAN an increased sense of strictness???

    Absolutely. However, Anne's point is that what's stricter is not the document type. Though the HTML 4.01 and XHTML 1.0 document types are not exactly the same, the latter aren't particularly more strict than the former. What's stricter is the syntax.

    Mind you in SGML the document type can dictate many aspects of syntax strictness, but that's not really all that relevant since HTML is only really SGML in theory.

    In any case the point is that XHTML 1.0 is stricter than HTML in syntax only because it is XML. When you take XML out of the equation by not parsing the document as XML, XHTML is in no way stricter---and that's a damned good thing, given the current nature of the Web.

    Posted by J. King at

  17. Well, I was not entirely truthful in my last statement. XHTML is actually stricter in some significant ways, but it's all things that most people using XHTML-as-HTML are not aware of anyway, so the actual differences in the document type are totally lost on most people.

    In other words, although XHTML 1.0 document types are kind of stricter in a couple of ways, it's not in the ways people who think they are stricter usually think they are, so their arguments are bunk.

    Posted by J. King at

  18. All those people who use XHTML incorrectly have at lease made the effort to do the 'right thing' even if they don't understand it yet. Give them a chance and they will come through, its all about learning.

    Posted by The Wolf at

  19. I may be wrong, but from what I've heard, XHTML isn't stricter than HTML, it just has a simpler syntax. Yes, simpler, since it allows for less deviation. It is (arguably) easier to code for, since you have less options when you're coding for it.

    Posted by Alexander Krivács Schrøder at

  20. Less options; well maybe if you don't consider eXtensbilty or multi namespaces, etc. and consider only plain vanilla XHTML 1.0 then yes well-formedness is probably easier for the author to learn.

    Posted by Robert Wellock at

  21. And lets face it, how often does that extensibility need to be used?

    Posted by The Wolf at

  22. No, Anne, I don't think you really understood what I said in that article. You try to translate it back again into technological terms, and that is not doing justice to my arguments.

    XHTML demands and promotes better coding standards than HTML. It is not about the strictness of the doctype. HTML allows for more deviation from the norm, and most of it ugly. That's why I say that for me as a coder, it is more for psychological reasons: it is about the beauty of the code and the desirability of the coding standards that go with it.

    The reason for going with Appendix C is a practical matter. I agree it would be more desirable to use XML tools from beginning to end, but hey, we live in an imperfect world.

    Posted by Ben at

  23. And lets face it, how often does that extensibility need to be used?

    At the moment it's more a question of how often can that extensibility be used. When the answer to that changes from "almost never" we should start seeing interesting uses.

    Posted by Brendan at

  24. And lets face it, how often does that extensibility need to be used?

    We’d see more like this if the extensibility really was useful in practice. What I’m particularly curious to see is what happens when SVG achieves significant browser support…

    Posted by Aristotle Pagaltzis at