HTML vs XHTML

HTML syntax, this is the format suggested for most authors. It is compatible with most legacy Web browsers. If a document is transmitted with the text/html MIME type, then it will be processed as an HTML document by Web browsers. This specification defines version 5 of the HTML syntax, known as "HTML5".

XHTML syntax, which is an application of XML. When a document is transmitted with an XML MIME type, such as application/xhtml+xml, then it is treated as an XML document by Web browsers, to be parsed by an XML processor. Authors are reminded that the processing for XML and HTML differs; in particular, even minor syntax errors will prevent a document labeled as XML from being rendered fully, whereas they would be ignored in the HTML syntax. This specification defines version 5 of the XHTML syntax, known as "XHTML5"

The DOM, the HTML syntax, and the XHTML syntax cannot all represent the same content. For example, namespaces cannot be represented using the HTML syntax, but they are supported in the DOM and in the XHTML syntax. Similarly, documents that use the noscript feature can be represented using the HTML syntax, but cannot be represented with the DOM or in the XHTML syntax. Comments that contain the string "-->" can only be represented in the DOM, not in the HTML and XHTML syntaxes.

XHTML: Well-formed is the new concept introduced by XML. Essentially this means that all elements must have closing tags and that all the elements must nested properly.

Element and attributes: XHTML documents must use lower case for all HTML element and attribute names. This difference is necessary because XHTML document is assumed to be an XML document and XML is case-sensitive e.g. <div> and <Div> are different tags.

Attribute value: Must always be quoted even those which appear to be numeric
e.g. <product id="100023" />

Alicia Gonzalez I am working on .Net since last 7 years.C# is really amazing language and I like to learn everything about C# and want to share whatever I know.
  • xml
  • html
By Alicia Gonzalez On 25 Dec, 12  Viewed: 431

Other blogs you may like

Read write xml in asp.net c#

Reading and writing in xml can be done in different ways, some common classes people use are XmlTextReader, XmlTextWriter , XmlDocument but we will use XDocument. By using the other classes say XmlTextReader we need to use the while loop to read and check every node by using XmlNodeType, for a long... By Ali Adravi   On 20 Dec 2014  Viewed: 1,993

Convert xml, json to class in asp.net c# by one click

Convert XML or JSON into a class by using visual studio is as easy as just copy and two clicks, never matter how big or how complicated is our XML or JSON. In this article we will create some dummy XML and json and will try to convert them into class without writing a single property manually. It... By Ali Adravi   On 20 Dec 2014  Viewed: 798

XmlDocument Vs XDocument and their usage

When there was XmlDocument why we need XDocument, is there any better feature available with XDocument, answer is yes, XDocument has a number of benefits, easy to create, easy to update, easy to search, ability to use LINQ to XML, cleaner object model etc. In this post we will see some examples... By Ali Adravi   On 16 Mar 2013  Viewed: 1,224

What is XML and it's usage?

XML (Extensible Markup Language) is a simple text-based format for representing structured information: documents, data, configuration, books, transactions, invoices, and much more. It was derived from an older standard format called SGML. **XML Used For** XML is one of the most widely-used... By Alicia Gonzalez   On 25 Dec 2012  Viewed: 311

Use XSLT to create menu from database

In some situations we need to create website menu from database, say our application have ability to create pages so that must also need to have a menu item to go to that page. So how to create menu with all those nice CSS and other settings, I think XSLT is best to use in these... By Hamden   On 16 Mar 2013  Viewed: 825