The XHTML Story

XHTML (Extensible HyperText Markup Language) is an XML mark up language that extends HTML.

Why XHTML when HTML is already there?

HTML is derived from SGML (Standard Generalized Markup Language) and it evolved to be too flexible. The motivation to create a XHTML was to make a more restrictive markup language that conforms to XML.This will allow standard XML parsers to parse XHTML.

This way, XHTML was expected to become:

1. Easily extensible

XML is extensible language. Hence it was thought that XHTML will also be extensible for the evloving needs of the web

2. Interoperable

New devices were being introduced (like mobile phones, handlheld devices, internet capable devices)
XHTML provides a means to specify which elements are supported by a device. XHTML can be transformed based on the capabilities of the device

HTML Vs XHTML

XHTML insists on some strict standards to keep it compatible with XML
Here are some of key differences:
1. Element tags and attributes should be in lower case.
<BODY> is invalid in XHTML whereas in HTML, it is acceptable.
Similarly, <input TYPE="TEXT"> is invalid in XHTML

2.Attribute values must be quoted and the ‘value’ part of the attribute is mandatory
so <div width=100%> should be <div width="100%"> and
<input type="checkbox" checked> should be <input type="checkbox" checked="checked">

2.All Elements must be closed and should be nested properly.
For example,

<p>line one
<p>line two

is invalid

<p>line one</p>
<p>line two</p>

is correct XHTML

<p>some text <strong>strong text</p></strong> is invalid
<p>some text <strong>strong text</strong></p> is correct XHTML

3.Tags like <br> and <input> that can not be closed should be written like this:
<br /> and <input />

4.DOCTYPE
DOCTYPE declares what version of HTML or XHTML the page is using. The browser can use this
information to display the page properly.
DOCTYPE is mandatory for an XHTML document

Progress and Adoption of XHTML

XHTML 1.0

In December 1998, W3C published a working draft titled “Reformulating HTML in XML”
In January 2000, w3c published the official XHTML 1.0 specification

XHTML 1.1

XHTML 1.1 added modularization – an abstract collection of components that can be subsetted and extended.
The spec reached recommendation stage in  May 2001

The Mime Type trouble

Mime type is a short string that the web server sends to the browser to indicate the type of the content.
The mime type of HTML is text/html whereas that of XHTML is application/xhtml+xml.
However, browsers like Internet Explorer (below version 8) didn’t recognize the XHTML mime type.
Hence websites had to stick to the text/html mime type even while serving XHTML documents
XHTML 1.1 – W3C Recommendation 31 May 2001

XHTML 1.2 didn’t realize

XHTML 1.2 was to include certain accesibility improvements and semantic support. However it never realized.
W3C closed the working group for in XHTML1.2 December 2010

XHTML 2.0 expired

The W3C worked on the next version of XHTML between 2002 and 2009. XHTML2 had plans to introduce dramatically different elements and features like XForms (improved version of forms) and Xframes a navigation tag <nl> and a single heading tag <h> that allows nesting and so on.

However, XHTML 2.0 broke away from XHTML1 or HTML4 in terms of compatibility. It was an attempt to make a “fresh start”. However, loosing backward compatibility was not an option for browser vendors. Web browsers had to include an entirely new engine to process XHTML2 based websites.
By 2009 december, XHTML2 Working Group was closed.

HTML5

HTML5 was designed to be backward compatible as well as flexible. For example, you can adhere to
the XHTML style of always using lowercase tags and using quotes “” in the attributes. However it is not forced.
Uppercase tags and non-quoted attributes are fine too. HTML5 is an attempt to define a single markup language in HTML or XHTML style.

HTML5 adds many useful features. Here are a few:

Multimedia features

You can add video or audio using native tags, without using any hacks or plugins.HTML5 introduces <video> and  <audio> tags. Plus, there is the <canvas> element, that allows dynamic rendering of graphics and images on the fly

Semantic Markup

Semantic markup tries to define meaning to parts and sections of a document rather than just defining the presentation.
The presentation is separated in to the CSS style-sheets.
Having the meaning embedded in the document helps automatic reading and correlating the document. For example,
the Google bots can read,understand, and correlate the document so that it can deliver better results when a
user searches for a related topic.

More info:

New elements like <section>, <article>, <header> and <nav>, are included in HTML5 to enrich the semantic features.

Local Storage

The ability to store data locally on the user’s computer is a great advantage to web application developers.
Previously, the only way was to use cookies. HTML5 introduces local storage. The new local storage has better security, performance and the data will persist even after the browser is closed. The local storage can be thought of as a client side database.
Ref:
How to use local storage : Smashing Magazine

Standardisation and adoption of HTML5

WHATWG published the HTML5 working draft in January 2008.
HTML5 Candidate Recommendation was released in December 2012
Ref:
HTML5: W3C Candidate Recommendation 17 December 2012
The W3C HTML Working Group published HTML5 as W3C Recommendation on 28 October, 2014.

Most browsers adopted HTML5 and implemented the new features. To check whether a feature is supported, these websites will be useful:

XHTML5

XHTML5 is the HTML5 version of XML with stricter syntax and XML compatibility. XHTML5 ust be served with XML mime type. It should throw error if the document is not well-formed. The purpose of XHTML5 is to give the features of HTML5 while being compatible with stricter XML syntax. There is certain uses where the document should be XML compatible.
Read More about XHTML5

Leave a Reply 0 comments

Close

Copy and paste this code to display the image on your site

Copied!