correct doctype syntax

S

shank

For some reason, the W3C validator is not recognizing my doctype all the
time.
I've tried this statement which is cut-n-pasted from their site.
Sometimes it's recognized, sometimes not and I have to manually select it to
validate.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> <--- Is this enough to be
correct?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd"> <-- Is this URL
required to be functionally correct?

I want 4.01 Strict and neither of the above statements seem to be recognized
100% of the time by the validator. Is there a better or different validator
that I can use?
thanks
 
S

Steve Pugh

shank said:
For some reason, the W3C validator is not recognizing my doctype all the
time.
I've tried this statement which is cut-n-pasted from their site.
Sometimes it's recognized, sometimes not and I have to manually select it to
validate.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> <--- Is this enough to be
correct?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd"> <-- Is this URL
required to be functionally correct?

The URL is not required in this case.

There are two reasons to include the URI
1. Including the URI changes browsers from quirks to standards mode.
This is the case with the 4.01 Transitional doctype where adding teh
URI triggers standards mode. But not the case for 4.01 Strict where
all variants of doctype trigger standards mode in all doctype sniffing
browsers.
2. The document is going to be given to a user agent that (a) actually
looks up the DTD based on the doctype and (b) doesn't already know
about the HTML 4.01 DTD. The chance that your page would be given to
such a tool are miniscule. Browsers don't look up DTDs and validators
know about HTML 4.01.
I want 4.01 Strict and neither of the above statements seem to be recognized
100% of the time by the validator.

Can you post the URI of a page where the validator doesn't recognise
the doctype?

Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,082
Messages
2,570,589
Members
47,211
Latest member
Shamestone

Latest Threads

Top