Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News XHTML 2 and HTML 5 continue to diverge

XHTML 2 and HTML 5 continue to diverge

This item in japanese

These two markup standards were designed to bring their predecessors up to date with the modern web. A cursory glance at the acronyms might lead one to believe that the specs are similar. In truth, they have quite different purposes and solve two distinct problems.

XHTML 2 is a step back towards the design philosophy of the HTML the web grew up on. It continues refining XHTML 1.x towards a clearer definition, while also providing enhancements such as improved hyperlinks, annotations, interactive forms, and specialized semantics. XHTML 2 is mainly targeted towards what the early web was good at: rendering documents and linking between them. A W3C working group initiated the development of the XHTML 2 standard in 2002.

HTML 5 will eventually replace HTML 4. In addition to enhanced markup, it provides several new APIs for handling multimedia, history, editing, etc. as InfoQ reported in January. HTML 5 was not started within the W3C, but was instead initiated by the WHATWG, or Web Hypertext Application Technology Working Group, in 2004. The group felt that XHTML 2 focused too much on rendering documents instead of providing markup features suitable for forums, e-commerce portals, and other sites that were not document-centric. HTML 5 was adopted by the W3C in 2007.

Both XHTML 2 and HTML 5 use different namespaces. This allows them to be implemented in the same XML processor. HTML 5 supports both text/HTML and XML serialization. And to confuse matters somewhat, the XML serialization built into HTML 5 is known as "XHTML 5."

The XHTML 2 standard is not reverse-compatible with XHTML 1.x or HTML 4. HTML 5 is somewhat compatible with HTML 4. The migration path from HTML 4 to HTML 5 is said to be smoother than from XHTML 1.x to XHTML 2. Neither standard is official yet. Most modern browsers support both HTML 4 and XHTML 1.x so it seems likely that both new specs will be supported as well.

Developer response to the new initiatives has been mixed. Robert Nyman blogs that:

...both specifications are interesting and definitely contain some nice enhancements, [but] I can't help but think when, and maybe even if, any of these will be ready for prime time. Maybe I'm just jaded, but for sure there will be endless discussions about which will be the best, different implementations in different web browsers and so on...

Freelancer Mike Malone allays some justifiable concern about another standards war in his own comparison of XHTML 2 and HTML 5:

What everyone wants to avoid is another standards war. Fortunately, since both languages support XML namespaces (or, in the case of the HTML serialization of HTML 5, DOCTYPE switching) it's unlikely that we'll see the sort of browser dependent behavior we did in the 1990s.

Rate this Article