[Sussex] Strange error when checking html with W3C validator

John D. john at johnsemail.eclipse.co.uk
Tue Jul 12 23:24:44 UTC 2005


As per some questions yesterday I've been writing some html (well xhtml 
really) and it's been my habit, to run the files through the W3C 
validator to make sure it's compliant.

If I use Firefox to locate the validator page and then use the 
validator, it comes back saying that I'm using valid (strict) xhtml etc 
etc, but if I find the validator page with Opera 8.01 and then run it to 
check the files it keeps giving me an error.

the error is like this:-

[QUOTE]
I was not able to extract a character encoding labeling from any of the 
valid sources for such information. Without encoding information it is 
impossible to reliably validate the document. I'm falling back to the 
"UTF-8" encoding and will attempt to perform the validation, but this is 
likely to fail for all non-trivial documents.

Below are the results of attempting to parse this document with an SGML 
parser.

1. Line 1, column 0: end of document in prolog
[/QUOTE]

whereas my xml and doctype declaration (and the opening html tag) look 
like this:-

[QUOTE]
<?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">
[/QUOTE]

So what am I doing wrong? Surely if the html/xhtml is valid (for the 
W3C) then it should also be correct for both browsers?

regards

John D.




More information about the Sussex mailing list