Detecting XHTML

Henri Sivonen scripsit:

> What about an HTML.next that's 100% convergent with XML
> and has a mode switch for opting into? It turns out that we
> already have that! It's called XHTML5 and the mode switch is the
> Content-Type: application/xhtml+xml HTTP header. Even better than some
> yet-to-be-defined HTML.next mode, it's already supported by the latest
> versions of the top browsers (if you count IE9 as the latest version
> of IE).

This troubles me, because it means that in order for XHTML5 to be viewed
in a browser as the author intended, it must be:

1) served from an HTTP server

2) on which the author can control the Content-Type: settings.

If either of these conditions is violated, the XHTML will be processed
as HTML.  That's bad, and there should be a document-internal flag that
forces the HTML parser to use the XHTML parser instead.  The obvious
candidate is an XML declaration, but I suppose you will tell me that
there are N tag-soup documents with XML declarations on them.

-- 
John Cowan   cowan@ccil.org    http://ccil.org/~cowan
Original line from The Warrior's Apprentice by Lois McMaster Bujold:
"Only on Barrayar would pulling a loaded needler start a stampede toward one."
English-to-Russian-to-English mangling thereof: "Only on Barrayar you risk to
lose support instead of finding it when you threat with the charged weapon."

Received on Tuesday, 4 January 2011 19:59:30 UTC