Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the need for XHTML?

Tags:

html

css

xhtml

In an interview I was asked a question that I'd never thought about, which was "We already have HTML which fulfills all the requirements of writing a web page, so what's the need for XHTML?"

I Googled a lot and also read many articles, but I'm not able to get properly why XHTML has been introduced. Please explain to me.

like image 940
djmzfKnm Avatar asked Feb 17 '09 17:02

djmzfKnm


People also ask

Why XHTML is needed?

XHTML was developed to make HTML more extensible and flexible to work with other data formats (such as XML). In addition, browsers ignore errors in HTML pages, and try to display the website even if it has some errors in the markup. So XHTML comes with a much stricter error handling.

Where XHTML is used?

XHTML documents can utilize applications such as scripts and applets that rely upon either the HTML Document Object Model or the XML Document Object Model. XHTML gives you a more consistent, well-structured format so that your webpages can be easily parsed and processed by present and future web browsers.

What are two advantages of XHTML?

When you use XHTML instead of HTML, it makes any future conversions easier. Besides, XHTML has extensibility and it can be supplemented with other markup languages also. Besides, XML processing programs can convert any document in the XHTML to other formats very easily.

What is the main feature of XHTML?

Features of XHTML: Unlike HTML, which is standard generalized markup language based, XHTML is XML-based. Compared to the rules of HTML, XHTML is stricter and does not allow any lapses in coding or structure. It prohibits the omission of any tags or usage of attribute minimization.


1 Answers

Because it is valid XML. That helps a lot since you can use a lot of tools originally designed for XML, such as XML parsers, XSLT, XPath, XQuery, ...

Normal HTML is a SGML dialect and that is not parsable without knowledge of the schema.

<ul>     <li>one     <li>two     <li>three </ul> 

is correct HTML but not correct XML. If you want to parse that, you have to know that ul-elements have to be closed but li s don't.

like image 112
Johannes Weiss Avatar answered Oct 07 '22 19:10

Johannes Weiss