home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  

Book HomeHTML & XHTML: The Definitive GuideSearch this book

3.4. Well-Formed Documents and XHTML

XHTML is HTML's prissy cousin. What would pass most beauty contests as a very proper and complete HTML document, done according to the book including end-paragraph tags, would get rejected by the XML judges as a malformed file.

To conform with XML, XHTML insists that documents be "well-formed." Among other things, that means every tag must have an ending tag, even the ones like <br> and <hr> that the HTML standard forbids the use of an end tag. With XHTML, the ending is placed inside the start tag: <br />, for example. Section 16.3.3, "Handling Empty Elements"

It also means that tag and attribute names are case-sensitive, and according to the current XHTML standard, must be in lowercase. Hence, only <head> is acceptable, and it is not the same as <HEAD> or <HeAd>, as it is with the HTML standard. Section 16.3.4, "Case Sensitivity"

And, too, well-formed XHTML documents, like HTML standard ones, conform to proper nesting. No argument there. Section 16.3.1, "Correctly Nested Elements"

In its defense, the XML standard and its offspring XHTML emphasize extensibility. That way, <p> can mean the beginning of a paragraph in HTML, whereas another variant of the language may define the contents of the <P> tag to be election-poll results, whose display is quite different, perhaps in tabular form with red, white, and blue stripes and accompanying patriotic music.

More about this in Chapter 15, "XML" and Chapter 16, "XHTML", in which we detail XML and XHTML standards (and the Forces of Conformity).

Library Navigation Links

Copyright © 2002 O'Reilly & Associates. All rights reserved.