Neil Turner's Blog

Blogging about technology and randomness since 2002

XML = Xtreme Morning Laceration

This morning I had a silly idea after reading Mark Pilgrim’s XML.com article “The Road to XHTML 2.0: MIME Types“. Now, on my site, I’m using XHTML 1.1, and according to the article, XHTML 1.1 has a MIME type of application/xhtml+xml, and not text/html. However, IE, being its usual ignorant self, does not understand what application/xhtml+xml is, so setting the Content-Type header to that will only end in tears for a considerable portion of my visitors.
Fortunately the article gives a nice bit of PHP code which will serve a application/xhtml+xml version of the page to any browser that asks for it. At the moment I think only Mozilla and its friends do but using this code means that it will work for other browsers if they support it in future.
So far so good. But Mozilla only likes well-formed XML – it can tolerate the odd missing tag in HTML, but in XML you get a rather ugly error message instead of your page. So I had to go through and fix all the errors in my code so that thing would display.
I then realised that I’d have to do this every single time I posted anything. So over to the MT Plugins directory for the Validable plugin which corrects many common markup errors for you. Phew. I thought.
But no. I then had to fiddle around with my blockquote tags since it was adding extra paragraph tags to them. Display-wise there was no problem but the W3C validator told me I had 30 errors – not good.
After another half hour or so of experimenting I finally found out what I was doing wrong and got it fixed. So it should all be fine and dandy now.
You may be thinking why I bother making it so difficult for myself – choosing the strictest DocType, making my pages valid XML etc. It’s to prove a point – sites which are accessable and that validate can look good. You only have to look at the people who have used downloaded and installed my templates over the past few weeks to see that I’m doing something right.
On the bright side, the site now works and I found out what ‘laceration’ means :).

Comments are closed.