XHTML, Happy marriage of HTML And XML Or A Mismatch?

By ucavik

Well so far it appears to be a happy nuptial between the two web markup languages. While HTML is a markup language used for displaying content of the web pages through the web browser, XHTML is a XML markup language which seeks to extend the functionality of HTML. XHTML and HTML are both applications of Standard General Markup Language (SGML). But then why XHTML was required when HTML was already working fine and at regular intervals, new versions of HTML were brought out by W3C? What were the advantages with such a drastic change? There were lots of benefits:

  • First and foremost evolution of XML made people start thinking about the benefits it could bring to HTML by separating the content and structure, thereby making it extensible and more efficient.
  • Since XHTML documents completely comply with the XML rules hence it will be easy to convert them into any of the popular formats like PDF, RFT or RSS.
  • XHTML documents can be easily reviewed, updated and validated by an XML parser like MSXML parser.
  • With HTML there were no stringent rules regarding well-formedness of the HTML elements or the tags, where as in the case of XHTML rules are very strict and there is no compromise on all the elements or tags being properly opened and closed.
  • In XHTML there are some elements which must exist in a webpage like html, head and body; otherwise an error message will be displayed, whereas in HTML you can do with out these elements. Moreover, in case of XHTML all the elements must be written in lower cases but in HTML you can write in upper case, lower case or an odd looking mixture of two.
  • XHTML further makes it compulsory to have the entire attribute enclosed in quotes and in HTML there is no such restriction, you have the luxury to be completely careless about not enclosing your attributes with in the quotes.
  • A webpage written using XHTML becomes instinctively compatible and friendly with lots of software using XML format for storing and exchanging data.

So this marriage between HTML and XML has not turned to be a mismatch in any manner. In fact, it has made HTML much stronger by bounding it with strong rules, regulations and discipline. A successful union is the one where one partner complements the other and the union emerges as a stronger entity than they ever were in their individual capacity. Here XML has made HTML more efficient and useful; in return XML could utilize the excellent markup capabilities of HTML and made the web page lot more extensible and useful.

Author: ucavik


»