spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

home / experts / xml / column6

XHTML 1.0: Where XML and HTML meet

Technical Lead
Thomson Reuters (Markets) LLC
US-NY-New York

Justtechjobs.com Post A Job | Post A Resume
Developer News
Microsoft Shows Off Silverlight 4, IE9 Plans
Metasploit Expands Vulnerability Test Framework
HyperCard Reborn?


Which old HTML sins to overcome?

The Ten Commandments of XHTML are:

  1. Fix up all documents that are not well-formed
    Well-formedness is a new concept introduced by XML. Essentially this means that all elements must be properly nested. Although overlapping is illegal in SGML, it was widely tolerated in existing browsers.
    NOT: <p>this is <em>emphasized</p></em>
    BUT: <p>this is <em>emphasized</em></p>
    
  2. Change all tags and attribute names to lower case
    XHTML documents must use lower case for all HTML element and attribute names. XML is case-sensitive, so for instance <li> and <LI> are different tags.
  3. 
    
  4. Add end tags for non-empty elements
    In SGML-based HTML 4 certain elements were permitted to omit the end tag; with the elements that followed implying closure. This omission is not permitted in XML-based XHTML. All elements other than those declared in the DTD as EMPTY must have an end tag.
    NOT: <p>one<p>two
    BUT: <p>one</p><p>two</p>
    
  5. Quote all attribute values
    All attribute values must be quoted, even those which appear to be numeric.
    NOT: <table rows=3>
    BUT: <table rows="3">
    
  6. Unminimize attributes
    XML does not support attribute minimization, attribute-value pairs must be written in full. Attribute names such as compact and checked cannot occur in elements without their value being specified.
    NOT: <dl compact>
    BUT: <dl compact="compact">
    
  7. Correctly tag empty elements
    Empty elements must either have an end tag or the start tag must end with />. For instance, <br/> or <hr></hr>. See below for information on ways to ensure this is backward compatible with HTML 4 user agents.
    NOT: <br><hr>
    BUT: <br/><hr/>
    

next page

http://www.internet.com

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
Rolling Out Your Own HTML Application Version Control · HTML 5: Client-side Storage · Working with Ajax Server Extensions
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Wi-Fi Product Watch, November 2009 · Chip Market Recovering From '08 Collapse · Low-Cost Tools to Kickstart Your New Business

Produced by Michael Claßen
All Rights Reserved. Legal Notices.

URL: http://www.webreference.com/xml/column6/2.html
Created: Feb. 07, 2000
Revised: Feb. 07, 2000