What's the need for XHTML?

后端 未结 16 2183
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-08 13:58

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

16条回答
  •  情深已故
    2020-12-08 14:29

    XHTML is simply about communication between systems. HTML is very difficult to parse, because of the number of variations that can occur as to what is well formed. Since XML is strict in its interpretation, this problem has been removed.

    Think about a RESTful architecture. If a URL is permanent location to an item, then systems which would want to access this item should be able to consume the information returned from accessing the URL. XHTML doesn't make this possible per se, because a system could already parse the HTML and retrieve the necessary information. XML just makes this easier. There is no limiting predefined set of tags which make it difficult to classify data in a document (althought techinically you can do this in HTML, because browsers will ignore it). You can use whatever you want to classify what data is retrieved.

提交回复
热议问题