This is application/xhtml+xml

Volume 7, Issue 12; 19 Jan 2004; last modified 08 Oct 2010

This essay is served as application/xhtml+xml. If you have difficulty, you may prefer the text/html version: http://norman.walsh.name/2004/01/18/text-html

Nothing will ever be attempted, if all possible objections must be first overcome.

Dr. Johnson

This essay is served with the MIME type “application/xhtml+xml”. If you’re reading this, then your browser did the right thing (or you worked fairly hard to get here, in which case, I thank you).

In the course of recent public debate on the appropriateness of recovering from well-formedness errors in XHTML, Mark Pilgrim caught me serving content that, at least by some metrics, purported to be XHTML and was not well-formed. (In fact, the server said it was “text/html” content so it was, by that metric, not in error, though it was clearly not “correct” either.)

I’m sticking to my guns and remaining a “draconian.” So David Carlisle challenged me to start serving my essays as “application/xml”. That would pretty much guarantee that the browser would report any lapses of concentration that caused me to accidentally generate markup that wasn’t well-formed.

In general, I expect that there are still far too many people using browsers that don’t know what to do with application/xml content to make it practical to serve it exclusively. But I’m not sure that’s true and it may in particular not be true you, my personal audience. (Have I thanked you recently for taking the time to read my ramblings? Thanks!)

So this essay is an experiment. If you can’t read this version of this essay but you can read the text/html version, let me know: tell me what browser you’re using and what platform, please. You can report successes too, of course.

I’ll keep a little summary of the statistics on the text/html page.

Lessons Learned

I’ve changed a few things in response to feedback. I think these will be improvements: [Last update: 19 Jan 2004.]

  • The recommended MIME type for XHTML is “application/xhtml+xml”.

  • But some browsers (notably IE) handle “application/xml” better than “application/xhtml+xml”.

  • A little content-negotiation is probably in order. Beyond that, the MathML folks have clearly blazed a trail for us to follow. (Thanks, guys!)

  • Don’t put a document type declaration on the XHTML pages, because IE goes off and reads it (Good for you, IE! An actual feature not a bug!)

  • Remove   entities. This is actually imperative now that I’ve removed the document type declaration (because entities with no possibility of a declaration makes the document not well-formed).