W3C home > Mailing lists > Public > html-tidy@w3.org > October to December 2003

Re: Valid HTML / XHTML

From: Rijk van Geijtenbeek <rijk@opera.com>
Date: Fri, 12 Dec 2003 10:24:06 +0100
To: html-tidy@w3.org, Thomas.Adams@bbdo-interone.de
Message-ID: <oprz19qgvoicz8n2@jol>

On Fri, 12 Dec 2003 00:21:22 -0800, Terry Teague  
<terry_teague@users.sourceforge.net> wrote:

> At 9:22 AM +0100 12/11/03, Thomas Adams wrote:

>> Dear Terry, i recently have used tidy (Windows version from 12th July
>> 2003) to validate my HTML. Given is the DOCTYPE XHTML 1.0 Transitional  
>> in
>> my code, tidy validates its fine (it means succesfully). Then I have
>> changed the Doctype to HTML 4.01,tidy still validates the code as HTML
>> 4.01 Transitional, but using W3C-Online HTMLvalidator the validation for
>> HTML 4.01 fails (but for XHTML 1.0 Transitional the validation by W3C is
>> succesful), especially the XHTML-Notation for <col width="20%"/>
>> causes the errors. My question is, is my code still valid HTML 4.01 or  
>> do I have to do some rework on my html-code to validate at W3C as well.

> I have forwarded your EMail to the appropriate mailing lists for comment.

First of all, people should know that HTML Tidy does not actually validate  
HTML or XHTML. It tries to output valid code, but it is well known that it  
doesn't force the content to match the constraints imposed by the chosen  

The XHTML notation for empty elements like <img .. /> and <col .. /> is  
valid in the XML syntax used for XHTML, but invalid in the syntax used for  
HTML. It should be <img .. > and <col .. > instead. And this syntax is  
invalid for XML, which requires either an explicit closing tag (</img>),  
or the /> notation to close the start tag of the empty element.

So when going from XHTML to HTML, and the other way around, the closing of  
empty element like IMG, COL, META and LINK has to be adjusted. If Tidy  
doesn't do this (IIRC, Tidy only fixes it when going from HTML to XHTML,  
not the other way around), the author has to manually do this. A search an  
replace of "/>" with ">" should do the trick.

The Web is a procrastination apparatus:    | Rijk van Geijtenbeek
It can absorb as much time as              |  Opera Software ASA
is required to ensure that you             |  Documentation & QA
won't get any real work done.  - J.Nielsen | mailto:rijk@opera.com
Received on Friday, 12 December 2003 04:25:10 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:38:54 UTC