W3C home > Mailing lists > Public > www-validator@w3.org > March 2007

Missing doctype

From: Jukka K. Korpela <jkorpela@cs.tut.fi>
Date: Mon, 5 Mar 2007 10:05:11 +0200 (EET)
To: Mety Soriano <metysoriano@yahoo.com>
cc: www-validator@w3.org
Message-ID: <Pine.GSO.4.64.0703050956280.19351@mustatilhi.cs.tut.fi>

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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 25 April 2012 12:14:23 GMT