spacer

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

home / experts / xml / column6

XHTML 1.0: Where XML and HTML meet

Data Center Architect
The Computer Merchant, Ltd
US-MA-chelsea

Justtechjobs.com Post A Job | Post A Resume
Developer News
News Flash: Adobe Has iPhone Workaround
Adobe's Flash 10.1 Goes Mobile (Minus iPhone)
A Salute to Visionary CEOs


How to ensure backwards compatibility?

Here are some design guidelines to follow for XHTML documents to render correctly in existing HTML user agents.

  1. Properly format empty elements I
    Include a space before the trailing / and > of empty elements, e.g. <br />, <hr /> and <img src="photo.jpg" alt="Photo" />. Also, use the minimized tag syntax for empty elements, e.g. <br />, as the alternative syntax <br></br> allowed by XML gives uncertain results in many existing user agents.
  2. 
    
  3. Properly format empty elements II
    Given an empty instance of an element whose content model is not EMPTY (for example, an empty title or paragraph) do not use the minimized form (e.g. use <p> </p> and not <p />).
  4. 
    
  5. Eliminate embedded Style Sheets and Scripts
    Use external style sheets and scripts if they use < or & or ]]> or --. XML parsers are permitted to silently remove the contents of comments, so the historical practice of "hiding" scripts and style sheets within comments to make the documents backward compatible is likely to not work as expected in XML-based implementations.
  6. 
    
  7. Avoid Line Breaks within Attribute Values
    Avoid line breaks and multiple whitespace characters within attribute values. These are handled inconsistently by user agents.
  8. 
    
  9. Use only one isindex element
    Don't include more than one isindex element in the document head. It is deprecated in favor of the input element.
  10. 
    
  11. Use the lang and xml:lang Attributes
    Use both the lang and xml:lang attributes when specifying the language of an element.
  12. 
    
  13. Fix up Fragment Identifiers
    In XML, URIs [RFC2396] that end with fragment identifiers of the form "#target" do not refer to elements with an attribute name="target"; rather, they refer to elements with an attribute defined to be of type ID, e.g., the id attribute in HTML 4. Many existing HTML clients don't support the use of ID-type attributes in this way, so identical values may be supplied for both of these attributes to ensure maximum forward and backward compatibility (e.g., <a id="target" name="target">...</a>).
  14. 
    
  15. Add the XML Character Encoding declaration
    To specify a character encoding in the document, use both the encoding attribute specification on the xml declaration (e.g. <?xml version="1.0" encoding="EUC-JP"?>) and a meta http-equiv statement (e.g. <meta http-equiv="Content-type" content='text/html; charset="EUC-JP"' >>).
  16. 
    
  17. Use Ampersand entities in Attribute Values
    When an attribute value contains an ampersand, it must be expressed as a character entity reference (e.g. "&amp"). For example, when the href attribute of the a element refers to a CGI script that takes parameters, it must be expressed as
    NOT: http://webref.com/cgi-bin/xml/demo1.pl?style=none&name=user
    BUT: http://webref.com/cgi-bin/xml/demo1.pl?style=none&amp;name=user
    

next page

http://www.internet.com

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

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

webref The latest from WebReference.com Browse >
Building a Banking Application Home Page with OOP · Mixing Scripting Languages · Review: phpFox, a Social Networking CMS with all the Bells and Whistles
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Enterprise 2.0: Social Networking in the Cloud · BroadSoft Marketplace Hastens Pace of Telephony Innovation · Review: HTC Hero for Sprint

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

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