Missing doctype

Under Subject: Re: Please help
On Mon, 5 Mar 2007, Mety Soriano wrote:

> I am testing on my test website to try the w3c compliance. How ever the 1 error
> occur, no doctype found. But i declared the doctype this the heading tag
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

That's a formally correct start (though many people think that using XHTML 
for web pages is pointless and XHMTL 1.0 Transitional is particularly 
pointless).

If you get a "no doctype found" message, you need to specify the URL of 
your document so that it can be analyzed; posting snippets of code only is 
generally not useful.

> <html xmlns="http://www.w3.org/1999/xhtml" />

There you have an error, but it has nothing to do with "no doctype found".
When the validator has found a document type declaration, or has been 
instructed otherwise to use a particular document type definition, it will 
probably issue a somewhat confusing, though formally correct, error 
message. The "/" before ">" makes the tag "self-closing", i.e. the markup 
is (by XML rules) equivalent to
<html xmlns="http://www.w3.org/1999/xhtml"></html>
which is in error, since both the <head> element and the <body> element 
are required.

-- 
Jukka "Yucca" Korpela, http://www.cs.tut.fi/~jkorpela/

Received on Monday, 5 March 2007 08:05:23 UTC