Displaying Versus Parsing In XHTML
In the heyday of HTML, browsers were designed specifically to display the results of HTML code that they were given. Those browsers displayed HTML through a set of hard-coded rules: for example, “at the appearance of <p>, skip a line and continue dis- playing the content.” Rules such as these allowed HTMLauthors to take “legal” short- cuts—or, more accurately, to write plain, sloppy code. According to the rule just stated, there is no need to close a paragraph using </p> as long as the next one starts with <p>—the rule will work and the content will be displayed properly. This is not the case with XML—and remember, XHTML is an XML language. XML documents are parsed before being displayed. Since XML languages can contain ele- ments and attributes that the browser may not already be familiar with, all elements and attributes must be checked before being displayed. An XML parser does this checking; it checks to make sure that the document is well formed. (...