Differences Between XHTML, HTML, and XML


Differences Between XHTML, HTML, and XML

There are two primary parts to XHTML:

•HTML 4
HTML 4 is a markup language used for displaying text and documents across different platforms and machines. It was originally intended for a very specific audience, and has expanded to include hypertext, multimedia, as well as the style of the documents displayed.

•XML
XML is an extensible markup language that was developed to retain the flexibility and power of HTML while reducing most of the complexity.
XHTML combines the flexibility of HTML with the extensibility of XML. But what does this mean?

With XHTML this is not necessary. With XHTML, if you find a need for a new markup tag, you simply define it in an XHTML module and use it in your page as you would any other HTML tag. You can also use XHTML to markup the code as appropriate for the (XHTML compatible) browser that is viewing it.


Comments

Author: satyendra kr. Pandit08 Mar 2010 Member Level: Silver   Points : 2

The original language of the World Wide Web is HTML (HyperText Markup Language), often referred to by its current version, HTML 4.01 or just HTML4 for short. HTML was originally an application of SGML (Standard Generalized Markup Language), a sort of meta-language for making markup languages. SGML is quite complicated, and in practice most browsers do not actually follow all of its oddities. HTML as actually used on the web is best described as a custom language influenced by SGML.

Another important thing to note about HTML is that all HTML user agents (this is a catchall term for programs that read HTML, including web browsers, search engine web crawlers, and so forth) have extremely lenient error handling. Many technically illegal constructs, like misnested tags or bad attribute names, are allowed or safely ignored. This error-handling is relatively consistent between browsers. But there are lots of differences in edge cases, because this error handling behavior is not documented or part of any standard. This is why it is a good idea to validate your documents.

XML and XHTML are quite different. XML (eXtensible Markup Language) grew out of a desire to be able to use more than just the fixed vocabulary of HTML on the web. It is a meta-markup language, like SGML, but one that simplifies many aspects to make it easier to make a generic parser. XHTML (eXtensible HyperText Markup Language) is a reformulation of HTML in XML syntax. While very similar in many respects, it has a few key differences.

First, XML always needs close tags, and has a special syntax for tags that don’t need a close tag. In HTML, some tags, such as img are always assumed to be empty and close themselves. Others, like p may close implicitly based on other content. And others, like div always need to have a close tag. In XML (including XHTML), any tag can be made self-closing by putting a slash before the code angle bracket, for example . In HTML that would just be

Second, XML has draconian error-handling rules. In contrast to the leniency of HTML parsers, XML parsers are required to fail catastrophically if they encounter even the simplest syntax error in an XML document. This gives you better odds of generating valid XML, but it also makes it very easy for a trivial error to completely break your document.



  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: