Anne van Kesteren

Serving up XHTML with the correct MIME type

I actually really like this article (this is not a good link text) of Simon Jessey. You can just code in XML, and through an easy check, you serve the browser what he can handle. Especially the part that you can just send HTML (valid!) to a browser that only understand that is really nice. Of course there should be some more checks, since the html element is not the only place you code the language in (I know I don't).

When you use this technique you can also code real XML and not /> (note the space), 'cause that was only to fool some browser that not supports the application/xhtml+xml MIME-type (or any other XML content type).

About the W3C 'article', it is just a NOTE, don't rely on that when you want to convert somebody. I did this wrong in the past, saying it is a W3C recommendation, but it isn't. I can see that if you have listened to me, you have a better XML document than before.

Small tip for people who hate file extension, like '.php': Thijs van der Vossen: Clean url's, I can't promote it enough :-)

(Finally Jeffrey's book arrived, I hope it is a good read)


  1. Thanks for the nod, Anne, although you must take some credit (or blame?) for the code, since it was you who introduced me to the basic technique. I changed the sentence about the W3C note as soon as I received your comment about it a few days ago.

    Posted by Simon Jessey at

  2. Yes I noted that, thanks! I just wanted to fix the mistake I made in the past telling it was an actual recommendation, which is was not.

    Posted by Anne at

  3. It looks fairly interesting and is slightly better than the method I use with PHP includes for serving: application/xhtml+xml I am highly temped to modify the method I use currently to something similar.

    Posted by Robert Wellock at