Tuesday, November 3, 2009

Benefits of XHTML




[ Team LiB ]









Benefits of XHTML


The benefits of switching to XHTML are many. Valid, well-formed XHTML works well with both new and old browsers. By structuring your content logically and separating presentation into style sheets, you'll save on bandwidth and maintenance costs while increasing accessibility, reach, and interoperability on alternate platforms. (Try viewing that complex table-based layout on a Palm Pilot.)


Properly designed XHTML documents typically are smaller and less complex than their HTML counterparts and are more easily viewed on older browsers. Valid XHTML documents are XML-conforming, so that they can be viewed, edited, and validated with standard XML tools. Best of all, you can extend XHTML documents with namespaces (collections of element-naming conventions) to combine multiple markup languages and add new tags.[4]


[4] Tim Bray, Dave Hollander, and Andrew Layman, "Namespaces in XML" [online], (Cambridge, MA: World Wide Web Consortium, 1999), available from the Internet at http://www.w3.org/TR/REC-xml-names/.


So, instead of this:



<html>
<head><title>Presentation-intermingled HTML Document</title>
<script type="text/javascript">
<!--
var = embedded_and_invalid_variables_and_code_goes_here;
-->
</script>
<body topmargin=0 leftmargin=0 ...>
<center><font size=5><b>Fake H1 Here</b></font></center>
<p><font style="arial, helvetica, sans-serif" size="3">Inline styled prose goes here. How
do you change the font site-wide?
</body>
</html>

Do this:



<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Strict XHTML Replacement</title>
<script src="/scripts/global.js" type="text/javascript"></script>
<link rel="/css/global.css" type="text/css" />
</head>
<body>
<h1>Structural Header Here</h1>
<p>Presentation-free prose goes here. Much cleaner.</p>
</body>
</html>

Here are some benefits of moving to XHTML:



  • Compatibility
    XHTML is both forward compatible with the structured world of XML and backward compatible with older HTML-based browsers.



  • Interoperability
    XHTML's logical structure allows easier repurposing of content for different platforms.




NOTE



According to Forrester Research, over 75 percent of desktop users will view web pages on alternative platforms, such as mobile phones, kiosks, and Palm Pilots. By 2008, over one third of the world's population will own a wireless device (http://cyberatlas.internet.com/markets/wireless/article/0,1323,10094_950001,00.html).





  • Extensibility
    XHTML documents can be extended to add new tags with namespaces. Or, because XHTML is XML, authors can add new tags without namespaces. These tags will be ignored by the browser, but they can be used by XML tools for exchanging data.



  • Productivity
    XHTML helps you improve productivity by separating presentation and behavior from structure. One team (the artists) can concentrate on style sheets while another (the programmers) can concentrate on behavior, and yet another (the XHTML coders) can concentrate on structure. Although this is possible with well-crafted HTML, strict XHTML (and XHTML 1.1 and 2) forces this clean separation.



  • XML Conforming
    XHTML documents have a reliable structure and conform to the rules of XML. XML processors can reliably manipulate and validate these conforming cargos of content for easier document and data exchange. Aggregators like O'Reilly's Meerkat (meerkat.oreillynet.com) and Userland's Radio (radio.userland.com) use RSS feeds to create meta-news sites and products.










    [ Team LiB ]



    No comments: