Using a Tool to Convert Your HTML Documents to XHTML

an article added by: Albert Lichtblau at 06022007


In: Categories » Computers and technology » HTML XHTML and CSS » Using a Tool to Convert Your HTML Documents to XHTML

Now that I've walked you through how to convert your HTML to XHTML manually, I'm going to drive you crazy by telling you that there is a program that does it for you.

HTML Tidy HTML guru Dave Raggett has written a program called HTML Tidy that "tidies up" your HTML by fixing all the previously detailed problems, including: - Misplacement of elements - Uppercase versus lowercase elements and attributes - Quotes around attribute values - Adding correct XHTML declarations and namespaces when prompted You can download this small application from its Web site (http://www.w3.org/People/Raggett/tidy/) and use it to auto-convert your own HTML. This has been ported to many platforms, and on the HTML Tidy Web site you can find the pre-compiled binaries for almost any operating system you are running. To convert your HTML document to XHTML using Tidy, all you have to do is make sure

tidy.exe (the application name) is accessible from your HTML files directory. Then use the following line: tidy –asxml –clean filename.html > filename.xhtml Running Tidy without any flags lowercases all elements and attributes, ensures all attribute values have quotes, and checks that the HTML is well formed with no stray elements. The -asxml flag adds in all the XHTML features including the namespace declaration, the XHTML DOCTYPE declaration, and the XML declaration. It also makes sure all the "empty" elements are formatted correctly for XHTML. Finally, the -clean flag converts <font> elements and center attributes to their CSS counterparts. Unfortunately, you have to do a little more tweaking if you want to have it do the same with elements such as <b>. Because Tidy has to fix the formatting of the <b> element and put both tags in the correct location, it doesn't convert it to CSS. Another run through Tidy and the problems are fixed. If you're comfortable with Tidy directly modifying your original document, you can add the -modify flag to make all changes in the source document. Let's take a look at what HTML Tidy does to your original HTML document:

   <?xml  version="1.0"?>
   <!DOCTYPE html PUBLIC  "-//W3C//DTD XHTML 1.0 Transitional//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
   <html  xmlns="http://www.w3.org/1999/xhtml">
   <head>
   <meta name="generator"  content="HTML Tidy, see www.w3.org" />
   <title>BK's Home  Page</title>
   <style  type="text/css">
   h1.c1 {color: red; text-align:  center}
   </style>
   </head>
   <body  bgcolor="#ffffff">
   <h1 class="c1">BK's  Home Page</h1>
   This is the homepage of BK DeLong.  Enjoy your visit!
   <p> My EverQuest  Friends:<br />
   <a  href="http://www.attrition.org/eq/crimen/"><b>Crimen
   Talionis</b></a><br  />
   MacIntyre<br />
   Kiekre<br />
   Krimzor<br />
   Catya</p>
   <hr />
   <b>B.K. DeLong<br />
   <a  href="mailto:bkdelong@zotgroup.com">
   bkdelong@zotgroup.com</a></b>
   </body>
   </html>
 

Note Notice that HTML Tidy has taken the CSS and converted it into a class reference as opposed to entering it inline. This is because there is only one <h1> in the document and therefore it can have a global style reference. There have been many concerns that use of HTML Tidy for an HTML to XHTML conversion can screw up some complex pages. Let's take a look at the UMass News Office Web site (http://www.umass.edu/newsoffice) This is a good example of a page coded in complex HTML using tables for precise layout.

   <html>
   <head>
   <title>UMass  News Office</title>
   <meta  http-equiv="Content-Type" content="text/html;  charset=iso-8859-1">
   <SCRIPT  language="JavaScript">
   <!--  Begin
   var  day="";var month="";
   var  ampm="";var ampmhour="";
   var  myweekday="";var year="";
   var oneDate  = new Date()
   mydate =  new Date();
   myday =  mydate.getDay();
   mymonth =  mydate.getMonth();
   myweekday=  mydate.getDate();
   weekday=  myweekday;
   myyear=  mydate.getFullYear(); <!--- THIS LINE CHANGES ----->
   year =  myyear;
   myhours =  mydate.getHours();
   ampmhour =  (myhours > 12) ? myhours - 12 : myhours;
   ampm =  (myhours >= 12) ? ' PM' : ' AM';
   mytime =  mydate.getMinutes();
   myminutes =  ((mytime < 10) ? ':0' : ':') + mytime;
   if(myday ==  0)
   day =  " Sunday, ";
   else  if(myday == 1)
   day =  " Monday, ";
   else  if(myday == 2)
   day =  " Tuesday, ";
   else  if(myday == 3)
   day =  " Wednesday, ";
   else  if(myday == 4)
   day =  " Thursday, ";
   else  if(myday == 5)
   day =  " Friday, ";
   else  if(myday == 6)
   day =  " Saturday, ";
   if(mymonth  == 0) {
   month =  "January ";}
   else  if(mymonth ==1)
   month =  "February ";
   else  if(mymonth ==2)
   month =  "March ";
   else  if(mymonth ==3)
   month =  "April ";
   else  if(mymonth ==4)
   month =  "May ";
   else  if(mymonth ==5)
   month =  "June ";
   else  if(mymonth ==6)
   month =  "July ";
   else  if(mymonth ==7)
   month =  "August ";
   else  if(mymonth ==8)
   month =  "September ";
   else  if(mymonth ==9)
   month =  "October ";
   else  if(mymonth ==10)
   month =  "November ";
   else  if(mymonth ==11)
   month =  "December ";
   // End  -->
   </SCRIPT>
   </head>
   <body  bgcolor="#FFFFFF" background="images/bkg.gif"  link="#003887"
   vlink="#006666"  alink="#006666">
   <!=================  RED MARGIN TABLE COLOR = 640000 WIDTH = 620
   CELLPADDING=2  =================>
   align="center">
   <tr  align="center" valign="top">
   <td  height="0">
   <table  width="98%" border="0" cellspacing="7"  align="center">
   <tr  align="left">
   <td  width="103" valign="top"  bgcolor="#FFFFFF"><img
   src="images/logo_head.gif"
   width="102"  height="100" alt="UMass Logo"></td>
   <td  width="183" valign="top" bgcolor="#FFFFFF">
   <div  align="right"><img src="images/news_head.gif"  width="180"
   height="99"></div>
   </td>
   <td  colspan="2" valign="top" bgcolor="#FFFFFF">
   <div  align="left"><img src="images/mass_head.gif"  width="297"
   height="99"></div>
   </td>
   </tr>
   <tr  align="left">
   <td  colspan="4" height="2" valign="top"  bgcolor="#FFFFFF">
   <div  align="left"><font size="-7"> <img  src="images/1pt.gif" width="600"
   height="1"  alt="&quot;&quot;" border="0">
   </font></div>
   </td>
   </tr>
   <tr  align="left">
   <td  height="2" bgcolor="#FFFFFF" colspan="4">
   <div  align="center"> <font face="Sabon, Times New Roman,  Palatino,
   serif"  size="3">
   <script>
   <!--//
   document.write()
   document.write(day  + month);
   document.write(myweekday  + ", " + year);<!---------------------- THIS LINE
   CHANGES  ----->
   // -->
   </script>
   </font></div>
   </td>
   </tr>
   <tr  align="left">
   <td  colspan="4" height="2" valign="top"  bgcolor="#FFFFFF">
   <div  align="left"><img src="images/2pt.gif"  width="600" height="5"
   alt="&quot;&quot;"  border="0">
   </div>
   </td>
   </tr>
   <tr  align="left"> <!========== UPDATE TIME/DATE STAMP GOES HERE
   ==========================>
   <td  colspan="2" bgcolor="#FFFFFF" height="0"  valign="top"><font
   face="Verdana,  Arial, Helvetica, sans-serif" size="1">UPDATED
   12:52 P.M.  APR. 21, 2000 ET<br>
   <a  href="summary/index.html">DAILY NEWS  SUMMARY</a></font></td>
   <td  bgcolor="#FFFFFF" height="0" valign="top">
   <div  align="left"><font size="1" face="Arial,  Helvetica, sans-serif">
   <font  face="Verdana, Arial, Helvetica, sans-serif"  size="1">&#187;</font>
   <font  face="Verdana, Arial, Helvetica, sans-serif"><i>Get
   UMass news  by <a href="update/">email</a> or on your
   <a  href="pda/">handheld</a>
   device.</i></font></font></div>
   </td>
   </td>
   <td  bgcolor="#FFFFFF" height="0" valign="top"  align="right">
   <form  action="http://cronos.oit.umass.edu/cgi-bin/query"  name="">
   <font  face="Verdana, Arial, Helvetica, sans-serif" size="1">
   <input  type=hidden name=mss value=simple>
   <input  type=hidden name=pg value=q>
   <input  type=hidden name=what value=web>
   <input  type=hidden name=fmt value=.>
   <input  type=hidden name=who value="This form queries News Office pages.">
   <input  type=hidden name=filter  value="url:http://www.umass.edu/newsoffice">
   <input  type="text" name="q" size="8"  value="">
   <input  type=submit name="Submit" value="Find">
   </font>
   </form>
   </td>
   </tr>
   <tr  align="left">
   <td  colspan="2" valign="top" rowspan="2"  bgcolor="#FFFFFF" height="0">
   <p  align="left"><font size="2" face="Verdana,  Arial,
   Helvetica,  sans-serif"><b><a  href="archive/2000/042100fashion.html">NY
   Journalist  Sees &quot;End of Fashion&quot;</a></b><br>
   Journalist  Teri Agins, senior special writer for the <i>Wall
   Street  Journal,</i> will speak on "The End of Fashion: The
   Mass  Marketing of the Clothing Business," at UMass Thurs.
   April 27 at  4 p.m. Her topic is also the focus of her new
   article,  published by William Morrow & Company. The lecture is
   free and  open to the public. </font></p>
   <p  align="left"><font size="2" face="Verdana,  Arial, Helvetica,
   sans-serif"><a  href="archive/2000/042000meyers.html"><b>Basketball
   Hall-of-Famer  Ann Meyers<br>
   Available  for Interviews</b></a><br>
   Ann Meyers,  the sports broadcaster and Basketball Hall-of-Famer
   who signed  with the Indiana Pacers in 1979, is available for
   interviews  in connection with the UMass Salute to Athletics
   Dinner  April 26 at the Fairmont Copley Plaza Hotel in Boston.
   </font><font  face="Verdana, Arial, Helvetica, sans-serif"  size="2">Meyers
   is the aunt  of UMass volleyball champion Jill Meyers. </font>
   </p>
   <p  align="left"><font size="2" face="Verdana,  Arial, Helvetica,
   sans-serif"><b><a  href="archive/2000/042000capsule.html">UMass
   to Dedicate  Time Capsule</a></b><br>
   UMass will  dedicate its Year 2000 Time Capsule in a campus
   celebration  May 1 at 4 p.m. on the library lawn. In addition
   to a brief  dedication ceremony, the event will feature music,
   T-shirts,  food, and prizes, as well as an opportunity for
   students to  have their photographs taken for placement in
   the time  capsule.</font> </p>
   </td>
   <td  width="160" valign="top" bgcolor="#FFFFFF"  height="0">
   <p  align="left"><font size="1" face="Verdana,  Arial, Helvetica,
   sans-serif"><b><img  src="photos/iris.jpg" width="160"  height="188"><br>
   Apr.  21</b><b> |</b> Photo of a spring lily from Morrill Greenhouse
   </font></p>
   <p><font  size="1" face="Verdana, Arial, Helvetica,  sans-serif"><b>
   <font  size="2"><br>
   Trends  &amp; Ideas:</font><br>
   Street  Journal,</i> will speak on "The End of Fashion: The
   Mass  Marketing of the Clothing Business," at UMass Thurs.
   April 27 at  4 p.m. Her topic is also the focus of her new
   article,  published by William Morrow & Company. The lecture is
   free and  open to the public. </font></p>
   <p  align="left"><font size="2" face="Verdana,  Arial, Helvetica,
   sans-serif"><a  href="archive/2000/042000meyers.html"><b>Basketball
   Hall-of-Famer  Ann Meyers<br>
   Available  for Interviews</b></a><br>
   Ann Meyers,  the sports broadcaster and Basketball Hall-of-Famer
   who signed  with the Indiana Pacers in 1979, is available for
   interviews  in connection with the UMass Salute to Athletics
   Dinner  April 26 at the Fairmont Copley Plaza Hotel in Boston.
   </font><font  face="Verdana, Arial, Helvetica, sans-serif"  size="2">Meyers
   is the aunt  of UMass volleyball champion Jill Meyers. </font>
   </p>
   <p  align="left"><font size="2" face="Verdana,  Arial, Helvetica,
   sans-serif"><b><a  href="archive/2000/042000capsule.html">UMass
   to Dedicate  Time Capsule</a></b><br>
   UMass will  dedicate its Year 2000 Time Capsule in a campus
   celebration  May 1 at 4 p.m. on the library lawn. In addition
   to a brief  dedication ceremony, the event will feature music,
   T-shirts,  food, and prizes, as well as an opportunity for
   students to  have their photographs taken for placement in
   the time  capsule.</font> </p>
   </td>
   <td  width="160" valign="top" bgcolor="#FFFFFF"  height="0">
   <p  align="left"><font size="1" face="Verdana,  Arial, Helvetica,
   sans-serif"><b><img  src="photos/iris.jpg" width="160"  height="188"><br>
   Apr.  21</b><b> |</b> Photo of a spring lily from Morrill  Greenhouse
   </font></p>
   <p><font  size="1" face="Verdana, Arial, Helvetica,  sans-serif"><b>
   <font  size="2"><br>
   Trends  &amp; Ideas:</font><br>
   </b>&#187;  <a href="http://www.umass.edu/newsoffice/archive/
   2000/041200research.html">Researchers
   Build  Something from (Almost) Nothing</a></font></p>
   <p><font  size="1" face="Verdana, Arial, Helvetica,  sans-serif">&#187;
   <a  href="archive/2000/041200williams.html">Student Wins Prestigious
   Goldwater  Scholarship</a> </font></p>
   <p><font  size="1" face="Verdana, Arial, Helvetica,  sans-serif">&#187;
   <a  href="archive/2000/041100suspend.html">Chancellor Orders
   Security  Cameras</a> </font></p>
   </td>
   <td  width="123" valign="top" bgcolor="#660000"  height="0">
   <div  align="right">
   <p  align="left"><a href="archive/"><img  src="images/btn_mir.gif"
   width="119"  height="37" border="0"  alt="Archives"></a><br>
   <a  href="engines/"><img src="images/btn_engine.gif"  width="119"
   height="38"  border="0" alt="Search Engines"></a><a  href="audio/"><img
   src="images/btn_audio.gif"  width="119" height="35" border="0" alt="Web
   Audio"></a><br>
   <a  href="experts/"><img src="images/btn_exp.gif"  width="119"
   height="37"  border="0" alt="Experts Online"></a><br>
   <a  href="prkit/"><img src="images/btn_photo.gif"  width="119"
   height="25"  border="0" alt="Press Kits"></a><br>
   <a  href="hfiles/faq.html"><img src="images/btn_faq.gif"
   width="119"  height="26" border="0" alt="Frequently Asked  Question"></a><br>
   <a  href="update/"><img src="images/btn_updt.gif"  width="119"
   height="35"  border="0" alt="UMass Update"></a><br>
   <a  href="pubs/"><img src="images/btn_pubs.gif"  width="119"
   height="37"  border="0" alt="UMass Periodicals"></a><br>
   <a  href="http://www.fivecolleges.edu"><img  src="images/btn_5col.gif"
   width="119"  height="35" border="0" alt="Five College  News"></a><br>
   <a  href="hfiles/staff.html"><img src="images/btn_staff.gif"  width="119"
   height="25"  border="0" alt="Ask an Editor"></a><br>
   <a  href="hfiles/feedback.html"><img  src="images/btn_feedback.gif"
   width="119"  height="26" border="0"  alt="Feedback"></a>
   </div>
   </td>
   </tr>
   <tr  bgcolor="#FFFFFF" align="left">
   <td width="165"  height="0" valign="top" bgcolor="#CCCC99">
   <table  width="100%" border="0" cellspacing="6"  cellpadding="0">
   <tr>
   <td><font  face="Verdana, Arial, Helvetica, sans-serif" size="1">
   <a  href="hfiles/foia.html">Guide
   to the FOIA  &amp; Mass. Public Document Laws</a></font></td>
   </tr>
   <tr>
   <td><font  face="Verdana, Arial, Helvetica, sans-serif" size="1">
   <a  href="hfiles/tools.html">Media/Reference
   Links</a></font></td>
   </tr>
   <tr>
   <td><font  face="Verdana, Arial, Helvetica, sans-serif" size="1">
   <a  href="hometn/index.html">Hometown
   News</a></font></td>
   </tr>
   <tr>
   <td><font  face="Verdana, Arial, Helvetica, sans-serif" size="1">
   <a  href="newsline/1299.html">News
   Office  News<i>Line</i></a></font></td>
   </tr>
   </table>
   </td>
   <td  width="123" height="0" valign="top" bgcolor="#FFCC66">
   <div  align="left">
   <p  align="center"><a  href="http://www.campaign.umass.edu">
   <img  src="images/campaign_btn.gif" width="123"  height="39" alt="News from
   Campaign  UMass" border="0"></a><font size="1"  face="Verdana, Arial,
   Helvetica,  sans-serif"><br>
   <br>
   <br>
   </font><font  size="2" face="Verdana, Arial, Helvetica, sans-serif">
   <a  href="archive/2000/041400campaign.html"><font  size="1">Campaign
   Tops  <br>
   $100  Million Mark</font></a><b></b></font></p>
   </div>
   </td>
   </tr>
   <tr  align="left">
   <td colspan="4"  valign="top" bgcolor="#FFFFFF">
   <div  align="center"><img src="images/3pt.gif"  width="600" height="2"
   alt="&quot;&quot;"  border="0"></div>
   </td>
   </tr>
   <tr  align="left">
   <td  colspan="4" valign="top" bgcolor="#FFFFFF"  height="0">
   <p><img  src="images/sm_logo.gif" width="72" height="63"  align="left"
   alt="UMass  Logo" border="0"><font size="2"><br>
   This is an  <a href="http://www.umass.edu/umhome/official.html">Official
   Publication</a>  of the University of Massachusetts Amherst
   Campus.</font></p>
   <p><font  size="2">Copyright &copy; 1997-2000. <a href="hfiles/
   about.html">About
   this  site</a> | <a href="hfiles/usage.html">Usage  Agreement</a>
   | <a  href="http://www.umass.edu/umhome/index.html">UMass Home
   Page</a></font></p>
   </td>
   </tr>
   </table>
   </td>
   </tr>
   </table>
   </td>
   </tr>
   </table>
   </body>
   </html>
   Here is the same code after its run through  Tidy:
   <?xml version="1.0"?>
   <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML  1.0 Transitional//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
   <!-- saved from url=(0043)http://www.umass.edu/newsoffice/nonova.html  -->
   <html  xmlns="http://www.w3.org/1999/xhtml">
   <head>
   <meta name="generator"  content="HTML Tidy, see www.w3.org" />
   <title>UMass News Office</title>
   <meta http-equiv="Content-Type"
   content="text/html; charset=iso-8859-1"  />
   <script type="text/javascript"  language="JavaScript">
   <!-- Begin
   var day="";
   var month="";
   var ampm="";
   var ampmhour="";
   var myweekday="";
   var year="";
   var oneDate = new Date()
   mydate = new Date();
   myday = mydate.getDay();
   mymonth = mydate.getMonth();
   myweekday= mydate.getDate();
   weekday= myweekday;
   myyear= mydate.getFullYear(); <!---- THIS  LINE CHANGES ----->
   year = myyear;
   myhours = mydate.getHours();
   ampmhour = (myhours > 12) ? myhours - 12 :  myhours;
   ampm = (myhours >= 12) ? ' PM' : ' AM';
   mytime = mydate.getMinutes();
   myminutes = ((mytime < 10) ? ':0' : ':') +  mytime;
   if(myday == 0)
   day = " Sunday, ";
   else if(myday == 1)
   day = " Monday, ";
   else if(myday == 2)
   day = " Tuesday, ";
   else if(myday == 3)
   day = " Wednesday, ";
   else if(myday == 4)
   day = " Thursday, ";
   else if(myday == 5)
   day = " Friday, ";
   else if(myday == 6)
   day = " Saturday, ";
   if(mymonth == 0) {
   month = "January ";}
   else if(mymonth ==1)
   month = "February ";
   else if(mymonth ==2)
   month = "August ";
   else if(mymonth ==8)
   month = "September ";
   else if(mymonth ==9)
   month = "October ";
   else if(mymonth ==10)
   month = "November ";
   else if(mymonth ==11)
   month = "December ";
   // End -->
   </script>
   <meta content="MSHTML  5.50.3825.1300" name="GENERATOR" />
   </head>
   <body vlink="#006666" alink="#006666"  link="#003887"
   bgcolor="#ffffff"  background="newsoffice_files/bkg.gif">
   <table cellspacing="0"  cellpadding="2" width="600" align="center"
   border="0">
   <tbody>
   <tr valign="top"  align="middle" bgcolor="#640000">
   <td height="0">
   <table cellpadding="5"  width="100%" align="center"
   bgcolor="#ffffff"  border="0">
   <tbody>
   <tr valign="top"  align="middle">
   <td height="0">
   <table cellspacing="7"  width="98%" align="center" border="0">
   <tbody>
   <tr align="left">
   <td valign="top"  width="103" bgcolor="#ffffff"><img  height="100"
   alt="UMass Logo"  src="newsoffice_files/logo_head.gif"
   width="102" /></td>
   <td valign="top"  width="183" bgcolor="#ffffff">
   <div align="right"><img  height="99"
   src="newsoffice_files/news_head.gif"  width="180" /></div>
   </td>
   <td valign="top" bgcolor="#ffffff"  colspan="2">
   <div align="left"><img  height="99"
   src="newsoffice_files/mass_head.gif"  width="297" /></div>
   </td>
   </tr>
   <tr align="left">
   <td valign="top"  bgcolor="#ffffff" colspan="4" height="2">
   <div align="left"><font  size="-7"><img height="1" alt='""'
   src="newsoffice_files/1pt.gif"  width="600" border="0" />
   </font></div>
   </td>
   </tr>
   <tr align="left">
   <td bgcolor="#ffffff"  colspan="4" height="2">
   <div align="center"><font
   face="Sabon, Times New Roman, Palatino,  serif" size="3">
   <script type="text/javascript">
   <!--//
   document.write()
   document.write(day + month);
   document.write(myweekday + ", " +  year);<!---THIS LINE CHANGES--->
   // -->
   </script>
   </font></div>
   </td>
   </tr>
   <tr align="left">
   <td valign="top"  bgcolor="#ffffff" colspan="4" height="2">
   <div align="left"><img  height="5" alt='""'
   src="newsoffice_files/2pt.gif"  width="600" border="0" /></div>
   </td>
   </tr>
   <tr align="left">
   <td valign="top"  bgcolor="#ffffff" colspan="2"  height="0"><font
   face="Verdana, Arial, Helvetica,  sans-serif" size="1">UPDATED 12:52
   P.M. APR. 21, 2000 ET<br />
   <a  href="http://www.umass.edu/newsoffice/summary/index.html">DAILY
   NEWS SUMMARY</a></font></td>
   <td valign="top"  bgcolor="#ffffff" height="0">
   <div align="left"><font  face="Arial, Helvetica, sans-serif"
   size="1"><font  face="Verdana, Arial, Helvetica, sans-serif"
   size="1">&raquo;</font>  <font
   face="Verdana, Arial, Helvetica,  sans-serif"><i>Get UMass news by
   <a  href="http://www.umass.edu/newsoffice/update/">email</a> or  on
   your <a  href="http://www.umass.edu/newsoffice/pda/">handheld</a>
   device.</i></font></font></div>
   </td>
   <td valign="top"  align="right" bgcolor="#ffffff" height="0">
   <form name=""  action="http://cronos.oit.umass.edu/cgi-bin/query">
   <font face="Verdana, Arial, Helvetica,  sans-serif" size="1"><input
   type="hidden" value="simple"  name="mss" /> <input type="hidden"
   value="q" name="pg" />  <input type="hidden" value="web"
   name="what" /> <input  type="hidden" value="." name="fmt" />  <input
   type="hidden" value="This form  queries News Office pages."
   name="who" /> <input  type="hidden"
   value="url:http://www.umass.edu/newsoffice"  name="filter" /> <input
   size="8" name="q" />  <input type="submit" value="Find"
   name="Submit"  /></font></form>
   </td>
   </tr>
   <tr align="left">
   <td valign="top"  bgcolor="#ffffff" colspan="2" height="0"
   rowspan="2">
   <p align="left"><font  face="Verdana, Arial, Helvetica, sans-serif"
   size="2"><b><a
   href="http://www.umass.edu/newsoffice/archive/2000/042100fashion.html">
   NY Journalist Sees "End of  Fashion"</a></b><br />
   Journalist Teri Agins, senior special writer for  the <i>Wall Street
   Journal,</i> will speak on "The End  of Fashion: The Mass Marketing
   of the Clothing Business," at UMass Thurs.  April 27 at 4 p.m. Her
   topic is also the focus of her new article,  published by William
   Morrow &amp; Company. The lecture is free  and open to the
   public.</font></p>
   <p align="left"><font  face="Verdana, Arial, Helvetica, sans-serif"
   size="2"><a
   href="http://www.umass.edu/newsoffice/archive/2000/042000meyers.html">
   <b>Basketball Hall-of-Famer Ann  Meyers<br />
   Available for  Interviews</b></a><br />
   Ann Meyers, the sports broadcaster and  Basketball Hall-of-Famer who
   signed with the Indiana Pacers in 1979, is  available for interviews
   in connection with the UMass Salute to Athletics  Dinner April 26 at
   the Fairmont Copley Plaza Hotel in  Boston.</font> <font
   face="Verdana, Arial, Helvetica,  sans-serif" size="2">Meyers is the
   aunt of UMass volleyball champion Jill  Meyers.</font></p>
   <p align="left"><font  face="Verdana, Arial, Helvetica, sans-serif"
   size="2"><b><a
   href="http://www.umass.edu/newsoffice/archive/2000/042000capsule.html">
   UMass to Dedicate Time  Capsule</a></b><br />
   UMass will dedicate its Year 2000 Time Capsule  in a campus
   celebration May 1 at 4 p.m. on the library lawn.  In addition to a
   brief dedication ceremony, the event will  feature music, T-shirts,
   food, and prizes, as well as an opportunity for  students to have
   their photographs taken for placement in the  time
   capsule.</font></p>
   </td>
   <td valign="top"  width="160" bgcolor="#ffffff" height="0">
   <p align="left"><font  face="Verdana, Arial, Helvetica, sans-serif"
   size="1"><b><img  height="188" src="newsoffice_files/iris.jpg"
   width="160" /><br />
   Apr. 21</b><b> |</b> Photo of  a spring lily from Morrill
   Greenhouse</font></p>
   <p><font face="Verdana, Arial,  Helvetica, sans-serif" size="1"><b>
   <font size="2"><br />
   Trends &amp; Ideas:</font><br />
   <br />
   </b>&raquo; <a
   href="http://www.umass.edu/newsoffice/archive/2000/041200research.html">
   Researchers Build Something from (Almost)  Nothing</a></font></p>
   <p><font face="Verdana, Arial,  Helvetica, sans-serif" size="1">
   &raquo; <a
   href="http://www.umass.edu/newsoffice/archive/2000/041200williams.html">
   Student Wins Prestigious Goldwater  Scholarship</a></font></p>
   <p><font face="Verdana, Arial,  Helvetica, sans-serif" size="1">
   &raquo; <a
   href="http://www.umass.edu/newsoffice/archive/2000/041100suspend.html">
   Chancellor Orders Security  Cameras</a></font></p>
   </td>
   <td valign="top"  width="123" bgcolor="#660000" height="0">
   <div align="right">
   <p align="left"><a  href="http://www.umass.edu/newsoffice/archive/">
   <img height="37"  alt="Archives" src="newsoffice_files/btn_mir.gif"
   width="119" border="0"  /></a><br />
   <a  href="http://www.umass.edu/newsoffice/engines/"><img  height="38"
   alt="Search Engines"  src="newsoffice_files/btn_engine.gif"
   width="119" border="0"  /></a><a
   href="http://www.umass.edu/newsoffice/audio/"><img  height="35"
   alt="Web Audio"  src="newsoffice_files/btn_audio.gif" width="119"
   border="0" /></a><br />
   <a  href="http://www.umass.edu/newsoffice/experts/"><img  height="37"
   alt="Experts Online"  src="newsoffice_files/btn_exp.gif" width="119"
   border="0" /></a><br />
   <a  href="http://www.umass.edu/newsoffice/prkit/"><img  height="25"
   alt="Press Kits"  src="newsoffice_files/btn_photo.gif" width="119"
   border="0" /></a><br />
   <a href="http://www.umass.edu/newsoffice/hfiles/faq.html"><img
   height="26" alt="Frequently Asked  Question"
   src="newsoffice_files/btn_faq.gif"  width="119"
   border="0" /></a><br />
   <a  href="http://www.umass.edu/newsoffice/update/"><img  height="35"
   alt="UMass Update"  src="newsoffice_files/btn_updt.gif" width="119"
   border="0" /></a><br />
   <a  href="http://www.umass.edu/newsoffice/pubs/"><img  height="37"
   alt="UMass Periodicals"  src="newsoffice_files/btn_pubs.gif"
   width="119" border="0"  /></a><br />
   <a href="http://www.fivecolleges.edu/"><img  height="35"
   alt="Five College News"  src="newsoffice_files/btn_5col.gif"
   width="119" border="0"  /></a><br />
   <a  href="http://www.umass.edu/newsoffice/hfiles/staff.html"><img
   height="25" alt="Ask an  Editor"
   src="newsoffice_files/btn_staff.gif"  width="119"
   border="0" /></a><br />
   <a  href="http://www.umass.edu/newsoffice/hfiles/feedback.html"><img
   height="26" alt="Feedback"  src="newsoffice_files/btn_feedback.gif"
   width="119" border="0"  /></a></p>
   </div>
   </td>
   </tr>
   <tr align="left" bgcolor="#ffffff">
   <td valign="top"  width="165" bgcolor="#cccc99" height="0">
   <table cellspacing="6"  cellpadding="0" width="100%" border="0">
   <tbody>
   <tr>
   <td><a  href="http://www.umass.edu/newsoffice/hfiles/foia.html">
   <font face="Verdana, Arial, Helvetica,  sans-serif" size="1">Guide
   to the FOIA &amp; Mass. Public Document  Laws</font></a></td>
   </tr>
   <tr>
   <td><a  href="http://www.umass.edu/newsoffice/hfiles/tools.html">
   <font face="Verdana, Arial, Helvetica,  sans-serif" size="1">
   Media/Reference  Links</font></a></td>
   </tr>
   <tr>
   <td><a  href="http://www.umass.edu/newsoffice/hometn/index.html">
   <font face="Verdana, Arial, Helvetica,  sans-serif" size="1">
   Hometown News</font></a></td>
   </tr>
   <tr>
   <td><a  href="http://www.umass.edu/newsoffice/newsline/1299.html">
   <font face="Verdana, Arial, Helvetica,  sans-serif" size="1">News
   Office  News<i>Line</i></font></a></td>
   </tr>
   </tbody>
   </table>
   </td>
   <td valign="top"  width="123" bgcolor="#ffcc66" height="0">
   <div align="left">
   <p align="center"><a  href="http://www.campaign.umass.edu/"><img
   height="39" alt="News from  Campaign UMass"
   src="newsoffice_files/campaign_btn.gif"  width="123"
   border="0" /></a><font  face="Verdana, Arial, Helvetica, sans-serif"
   size="1"><br />
   <br />
   </font><a
   href="http://www.umass.edu/newsoffice/archive/2000/041400campaign.html">
   <font face="Verdana, Arial, Helvetica,  sans-serif" size="2"><font
   size="1">Campaign Tops<br />
   $100 Million  Mark</font></font></a></p>
   </div>
   </td>
   </tr>
   <tr align="left">
   <td valign="top"  bgcolor="#ffffff" colspan="4">
   <div align="center"><img  height="2" alt='""'
   src="newsoffice_files/3pt.gif"  width="600" border="0" /></div>
   </td>
   </tr>
   <tr align="left">
   <td valign="top"  bgcolor="#ffffff" colspan="4" height="0">
   <p><img height="63"  alt="UMass Logo"
   src="newsoffice_files/sm_logo.gif"  width="72" align="left"
   border="0" /><font  size="2"><br />
   This is an <a  href="http://www.umass.edu/umhome/official.html">
   Official Publication</a> of the University  of Massachusetts Amherst
   Campus.</font></p>
   <p><font  size="2">Copyright &copy; 1997-2000. <a
   href="http://www.umass.edu/newsoffice/hfiles/about.html">About  this
   site</a> | <a
   href="http://www.umass.edu/newsoffice/hfiles/usage.html">Usage
   Agreement</a> | <a  href="http://www.umass.edu/umhome/index.html">
   UMass Home  Page</a></font></p>
   </td>
   </tr>
   </tbody>
   </table>
   </td>
   </tr>
   </tbody>
   </table>
   </td>
   </tr>
   </tbody>
   </table>
   </body>
   </html>
 

 

HTML-Kit If handling the files one at a time is still too much for you, consider downloading a program from Chami.com called HTML-Kit. This program, while not a WYSIWYG tool, offers Web developers complete control over their HTML documents. HTML-Kit's creators also were smart enough to integrate HTML Tidy as a push-button function. This enables you to load up your documents and, using a menu option, convert your HTML to XHTML. You can download the program at http://www.chami.com/html-kit/.

Java Tidy Software developer Andy Quick (http://www3.sympatico.ca/ac.quick/) migrat-ed HTML Tidy into a JavaBean to allow for more versatility and to make it easier to add as a component to any commercial or in-house development package. You can download a copy at http://www3.sympatico.ca/ac.quick/jtidy.html.

BBTidy Web developers using the Macintosh platform will appreciate BBTidy (http://www.geocities.com/SiliconValley/1057/tidy.html), a plug-in to the ever-popular BBEdit Web editing environment that does much the same that the HTML Tidy feature in HTML-Kit does.

Batch conversion Unfortunately, no program can spider through a site and auto-convert it from HTML to XHTML. However, using HTML Tidy, you can do it directory by directory. Providing you use the -modify or -m flag to make the HTML-to-XHTML conversion take place within the source document, you can use wildcards with Tidy. To convert a whole directory of documents, use the following line: tidy -asxml –clean –modify *.html This line converts every .html document in the directory to XHTML.

Document Validation Whether you perform the conversion process by hand or use a program, nothing is infallible. HTML Tidy has not been tested fully to see if it produces 100 percent valid and well-formed XHTML in each and every instance – and in hand-coding, there's always one or two things someone overlooks. That's why it is very important to use a validation tool to check your documents and be absolutely sure. The best Web-based solution for XHTML validation is the W3C Validation Service (http://validator.w3.org). This is a great way to see what you're missing in your conversion process. Just make sure you have one of the three XHTML DOCTYPE declarations or it will validate your document as HTML.

legal notice

Our website is not responsible for the information contained by this article. Web-articles is a free articles resource.
Suggestion: If you need fresh, daily updated content for your website, feel free to use our service. Click here for more information.

Useful tools and features

Link to this article from your page    Send this article to you or to a friend
If you like this article (tutorial), please link to it from your web page using the information above.

related articles

1. Moving From HTML to XHTML
Overview Hypertext Markup Language (HTML) is getting an enormous and overdue cleanup. Much of HTML's early charm as browsers reached a wide audience was the ease of use created by browser tolerance for a wide variety of syntactical variations and unknown markup. Unfortunately, that charm has worn thin through years of "browser wars" and demands for new features that go beyond presenting documents. The World Wide Web Consortium (W3C) is rebuilding HTML on a new foundati...

2. HTML and XHTML Application Possibilities
Overview Shifting from HTML to XHTML requires a significant change in mindset from the design-oriented freefor- all that characterized the early years of the Web. This change in style reflects movement in the underlying architecture toward a more powerful and more controllable approach to document creation, presentation, and management. Understanding the connections between the architectural and stylistic changes may help you find more immediate benefits from XHTML –...

3. Coding Styles HTMLs Maximum Flexibility
The XHTML 1.0 specification provides a set of rules for XHTML (User Agent Conformance) that includes a rough description of how XHTML software differs from HTML software, though these rules exist mostly to bring XHTML rendering practice in line with the rules for parsing XML 1.0. XHTML also is designed to remain compatible (mostly) with the previous generation of HTML applications, so it may take a while for the transition to occur. Pure XHTML user agents (also known as XHTML processing software) aren't l...

4. XML and XHTMLs Maximum Structure
Coding Styles— XML and XHTML's Maximum Structure Overview XML parsers are far more brutal about rejecting documents they don't like than are HTML browsers. XML's clear focus on structure demands that the practices described in the previous chapter must change. However, most of those changes shouldn't cause more than minor inconveniences – at least for newly created documents. Note If reading this chapt...

5. XML and CDATA
Processing instructions XML also enables developers to pass information to the application through processing instructions (often called PIs). Processing instructions use a similar syntax to the XML declaration, although the rules for them are much less strict. Processing instructions begin with <? and end with ?>, but the developer generally dictates their contents. The first bit of text before a space appears in a PI is called the target. The target must start with a letter, unde...

6. lang Internationalization
Internationalization: xml:lang and lang Internationalization (often abbreviated i18n because 18 characters appear between the i and the n) gets a significant boost with the shift to XML primarily because of XML's use of Unicode as the underlying character model. While not every document needs to encode Chinese, Cyrillic, Arabic, and Indian characters, Unicode makes it possible for all of these forms to exist within a single document. In addition, XML and XHTML allow for the possibility of other e...

7. Anatomy of an XHTML Document
The transition from HTML to XHTML will come with a fair number of bumps. While later chapters introduce tools to help you get past those bumps – and figure out where they come from – this chapter examines what's going to change and demonstrates a few strategies for handling those changes. Along the way, we visit the ghosts of browsers past and explore problems that exist in current browsers. In turn, you discover how prepared and unprepared various tools are for XHTML. Note Som...