HTML
  Home arrow HTML arrow Page 6 - HTML Comes of Age: XHTML
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
HTML

HTML Comes of Age: XHTML
By: Don Kiely
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 4
    2003-03-03

    Table of Contents:
  • HTML Comes of Age: XHTML
  • Two Great Tastes that Taste Great Together
  • Extensible HTML
  • XHTML Syntax
  • Rocky Upgrade Path
  • Moving to XHTML
  • Roping the Wild, Wild Web

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    HTML Comes of Age: XHTML - Moving to XHTML


    (Page 6 of 7 )

    As with any time an irresistible new technology comes along, a Web author has to decide whether to migrate pages from HTML or start over from scratch and take full advantage of XHTML. There are a number of benefits to upgrading as well as some major pitfalls.

    Because HTML is a pervasive standard and XML is becoming one, users can view carefully crafted XHTML documents in current versions of many browsers. In fact, a strictly conforming XHTML page is almost a joy to a browser because there isn't all the messy ambiguity that it finds in most Web pages built with HTML. Earlier browsers may choke on new HTML 4.01 tags, but that isn't XHTML's fault.

    XHTML supports three main media types supported by most browsers, text/html, text/xml, and application/xml. Any scripting code that uses the HTML or XML document object models will work just fine in the new format.

    The biggest time sinks in migrating HTML pages to XHTML will be converting tags and attributes to lower case, and adding quotes to attribute values. The cleaner the HTML code, the quicker that you'll be able to convert it to XHTML.

    As this new standard sees wider adoption, new and existing Web editors are supporting XHTML and some will automatically convert existing pages. Code translators have long been the holy grail of computer science, but there is a reasonable chance that HTML to XHTML tools will actually work reliably. This is because most of the work is pretty mechanical: straightening out non-nested tags, embedding script in CDATA, including the DOCTYPE directive, etc. But some sloppy HTML code, acceptable to many old browsers, will translate poorly.

    There are various tools listed on the W3C's XHTML Web site, but my favorites so far are HTML Kit and HTML Tidy working together (see the list of references on page &&). Figure 4 shows the HTML Kit freeware editor with the XMLDeveloper Web site tidied up for XHTML on the right.



    Figure 4: The page at http://www.thethirdsector.com/, shown in HTML Kit, is easily and mechanically modified to comply with the XHTML standard. The biggest problem on this page is missing closing tags.

    The XHTML standard has some rather rigid requirements for user agents, W3C-speak for browsers. Table 3 provides a summary of the requirements. These are generally only of interest to developers who are writing an XHTML browser, but understanding the required actions will help you as an XHTML developer understand how your content will be rendered, especially if there are any errors in the code. The W3C has various documents with guidelines for building user agents, if you want more information.

    Table 3: Summary of XHTML requirements for user agent conformance.

    In order to be consistent with the spec, a browser has to parse and evaluate an XHTML document for well-formedness, and if it claims to be a validating user agent, it must also validate documents against their referenced DTDs.
    When a user agent processes an XHTML document as generic XML, it shall only recognize attributes of type ID as fragment identifiers. Fragment identifiers delineate portions of a document.
    If a user agent encounters an element it does not recognize, it must render the element's content.
    If a user agent encounters an attribute it does not recognize, it must ignore the entire attribute specification, including both the attribute and its value.
    If a user agent encounters an attribute value it doesn't recognize, it must use the default attribute value.
    If it encounters an entity reference for which the User Agent has processed no declaration, the entity reference should be rendered as the characters that make up the entity reference.
    When rendering content, User Agents that encounter characters or character entity references that are recognized but not renderable should display the document in such a way that it is obvious to the user that normal rendering has not taken place.
    The following characters are defined in [XML] as whitespace characters
    Space ( )
    Tab ( )
    Carriage return ( )
    Line feed ( )
    and the user agent must comply with XHTML rules for whitespace elimination.
    In order to be consistent with the spec, a browser has to parse and evaluate an XHTML document for well-formedness, and if it claims to be a validating user agent, it must also validate documents against their referenced DTDs.
    When a user agent processes an XHTML document as generic XML, it shall only recognize attributes of type ID as fragment identifiers. Fragment identifiers delineate portions of a document.
    If a user agent encounters an element it does not recognize, it must render the element's content.
    If a user agent encounters an attribute it does not recognize, it must ignore the entire attribute specification, including both the attribute and its value.
    If a user agent encounters an attribute value it doesn't recognize, it must use the default attribute value.
    If it encounters an entity reference for which the User Agent has processed no declaration, the entity reference should be rendered as the characters that make up the entity reference.
    When rendering content, User Agents that encounter characters or character entity references that are recognized but not renderable should display the document in such a way that it is obvious to the user that normal rendering has not taken place.
    The following characters are defined in [XML] as whitespace characters
    Space ( )
    Tab ( )
    Carriage return ( )
    Line feed ( )
    and the user agent must comply with XHTML rules for whitespace elimination.

    More HTML Articles
    More By Don Kiely


     

    HTML ARTICLES

    - Using a 3D HTML Table as a Recordset
    - Building a 3D HTML Table
    - Maximizing and Restoring HTML Images: Layer ...
    - Completing Construction of a Database Form w...
    - Maximizing and Restoring Images in a Tabular...
    - Building the Recordset for an HTML Database ...
    - Laying Out a Database Form with HTML
    - Tabular Database Form Functions with HTML
    - Tabular Database Forms with HTML
    - Using the Find Functions for HTML Database F...
    - Sorting for Database Forms with HTML
    - Edit and Other Database Form Functions with ...
    - More Database Form Functions with HTML
    - Database Form Functions with HTML
    - Using the HTML Table Element as a Recordset






    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
    Stay green...Green IT