HTML vs XHTML part 1

Posted by Mark Rogers on Nov 12, 2007 | 

Web Standards

There are a lot of good reasons for switching to XHTML, but there are some drawbacks as well.

Imagine you're responsible for a major e-commerce web site, and you make the decision to migrate the entire site from HTML to XHTML, serving it to standards compliant browsers (like Firefox) using the W3C recommended MIME type application/xhtml+xml.

A couple of months after the switch someone types <br> instead of <br/> when making a minor edit to the main site template. Before the switch from HTML nothing bad would happen. Now every page on the site is displaying an XML parser message in Firefox, you're losing thousands of dollars of sales per minute, and your CEO is asking some very difficult questions.

Why has a tiny change become so catastrophic?

When you're serving HTML browsers treat it as "tag soup" and are very forgiving of errors. Once you serve your pages as application/xhtml+xml Firefox treats them as XML and won't display them if they contain badly formed XML (in this case a <br> without an end tag).

If you've made the decision to go down the XHTML route you should consider a whole-site validation tool, like our SortSite product. After all, your job might depend on it.


First posted Nov 2007