Tags

,

Introduction:

Almost everybody knows HTML, especially computer science students like me. HTML (Hyper Text Markup language) is the main markup language for displaying web pages and other information that can be displayed in the web browser. However, not many people know what XHTML exactly is. XHML is a family of XML languages which extend or mirrors versions of HTML. It does not allow omission of any tags or use of attribute minimization. XHTML requires that there be an end tag to every start tag and all nested tags must be closed in the right order. For example, while <br> is valid in HTML, it would be required to write <br/> in XHTML. Here we are just talking about HTML4.01 and XHTML 1.0.

HTML and XHTML are closely related and therefore can be documented together. Both HTML 4.01 and XHTML 1.0 have three sub specifications – strict, loose and frameset. The difference opening declarations for a document distinguishes HTML and XHTML. Other differences are syntactic.

Which is better?

Is there any advantage to using HTML 4.01 over XHTML 1.0? There is no simple answer and the benefits you will gain are tied to how you’re using the language in a given situation.

Switching from HTML 4.01 to XHTML 1.0 brings almost no direct benefits for the visitors of your Web site; still, there are several good reasons for Web authors to make the switch:

  1. XHTML is easier to maintain:

In HTML, case, quotes, termination of many elements and uncontained elements are allowed and commonplace. The margin for errors in HTML is much broader than in XHTML, where the rules are very clear. As a result, XHTML is easier to author and to maintain, since the structure is more apparent and problem syntax is easier to spot.

XML syntax rules are far more rigorous than HTML. As a result, XHTML makes authors work more precisely.

2. XHTML is XSl ready

As you are probably aware by now, XHTML 1.0 is the reformulation of HTML 4.01 in XML. Therefore, XHTML documents are hypertext documents and XML documents. A powerful technology has been developed at W3C to manipulate and transform XML documents: the Extensible Style sheet Language Transformations (XSLT). This technology is tremendously useful to create various new resources automatically from an XHTML document.

3. XHTML is easier to teach and to learn

The syntax rules defined by XML are far more consistent than those found in HTML and therefore easier to explain than the SGML rules on which HTML is based.

4. XHTML is ready for the future

When the new version of XHTML becomes a recommendation, XHTML 1.0 documents will be easily upgradable to this new version, to allow taking advantages of its exciting new features. It’s likely that an XSLT style sheet will be available by then to help you move your XHTML 1.0 (strict) documents to XHTML 2.0 documents.

Here maybe you would say: “wow, XHTML is so great and I would never use HTML”. However, things changed significantly when HTML5 was introduced. HTML5 is a markup language for structuring and presenting content for the World Wide Web, and is a core technology of the Internet originally proposed by Opera Software. It is the fifth revision of the HTML standard and is still under development.

Introducing of HTML5 and XHTML2

Overview of HTML5

Compared with HTML4, HTML5 are a few differences as following.

  • New parsing rules: oriented towards flexible parsing and compatibility; not based on SGML
  • Ability to use inline SVG and MathML in text/html
  • New elements:
  • New types of form controls: dates and times, email, url, search, number, range, tel, color
  • New attributes: charset (on meta), async (on script)
  • Global attributes (that can be applied for every element): id, tabindex, hidden, data-* (custom data attributes)
  • Deprecated elements will be dropped altogether

Overview of XHTML2

A new version of XHTML is able to make a clean break from the past by discarding the requirement of backward compatibility. This lack of compatibility with XHTML 1.x and HTML 4 caused some early controversy in the web developer community.

Comparison between HTML5 and XHTML2

HTML5 emphasis:

  • Focus more on transitional technology than revolutionary
  • Address deficiencies in HTML4
  • More open working group
  • Maintain a SGML syntax
  • Can choose whether to serialize as HTML or XML

XHTML 2 Emphasis:

  • XHTML 2.0, unlike previous incarnations, is based solely on XML.
  • It has greater emphasis on XML technologies such as SForms, SML Events, etc.
  • It even has more emphasis of separating presentation and structure.
  • Better internationalization.

Which one is better?

  • HTML5 has better support amongst upcoming browsers
  • XHTML continues to push us towards the future of the web-xml
  • HTML5 allows for less strict makeup (unlike XML)
  • HTML5 introduces great layout elements
  • XHTML2 has greater focus on separating presentation and structure.

I think both standards offer solutions to different developers.

Advertisements