spacer

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

home / experts / xml / column6

XHTML 1.0: Where XML and HTML meet

Information Technology Auditor (PA)
Next Step Systems
US-PA-Wayne

Justtechjobs.com Post A Job | Post A Resume
Developer News
Google Chrome Playing Catch-Up on Extensions
Open Solutions Alliance Gets New Leadership
Red Hat Spacewalk Expands Linux Management

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.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info

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

Whitepapers and eBooks

Symantec Whitepaper: Converging System and Data Protection for Complete Disaster Recovery
Intel Whitepaper: Comparing Two- and Four-Socket Platforms for Server Virtualization
IBM Solutions Brief: Go Green With IBM System xTM And Intel
HP eBook: Simplifying SQL Server Management
IBM Contest: Are You the Next Superstar? Join the "Search for the XML Superstar" Contest to Find Out
Intel PDF: Quad-Core Impacts More Than the Data Center
Intel PDF: Virtualization Delivers Data Center Efficiency
Go Parallel Article: PDC 2008 in Review
Avaya Article: Communication-Enabled Mashups: Empowering Both Business Owners and IT
Intel Whitepaper: Building a Real-World Model to Assess Virtualization Platforms
PDF: Intel Centrino Duo Processor Technology with Intel Core2 Duo Processor
Microsoft Article: Build and Run Virtual Machines with Hyper-V Server 2008
  Go Parallel Article: Q&A with a TBB Junkie
IBM Whitepaper: Innovative Collaboration to Advance Your Business
Internet.com eBook: Real Life Rails
IBM eBook: The Pros and Cons of Outsourcing
Internet.com eBook: Best Practices for Developing a Web Site
IBM CXO Whitepaper: The 2008 Global CEO Study "The Enterprise of the Future"
Avaya Article: Call Control XML in Action - A CCXML Auto Attendant
IBM CXO Whitepaper: Unlocking the DNA of the Adaptable Workforce--The Global Human Capital Study 2008
Adobe Acrobat Connect Pro: Web Conferencing and eLearning Whitepapers
Symantec Whitepaper: Comprehensive Backup and Recovery of VMware Virtual Infrastructure
MORE WHITEPAPERS, EBOOKS, AND ARTICLES
webref The latest from WebReference.com Browse >
Popular JavaScript Framework Libraries: An Overview - Part 3 · Accessing Your MySQL Database from the Web with PHP · Working with the DOM Stylesheets Collection
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Review: Lenovo ThinkPad SL300 · OCZ PC3-10666 Gold 2x1GB Review · Apple Recommends Antivirus for Macs

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