RE: Doctype Declaration & Validation - need explanation

by =?iso-8859-1?Q?St=E9phane?= Bergeron <stephberg(at)videotron.ca>

 Date:  Fri, 03 Nov 2000 13:34:46 -0500
 To:  hwg-techniques(at)hwg.org
 In-Reply-To: 
  todo: View Thread, Original
At 09:44 AM 03/11/00 -0700, you wrote:
><<a) ...I have not really gotten to the point of understanding the
>full purpose of the DOCTYPE declaration.>>
>essentially, the doctype declaration is what makes the html work...  my
>understanding of it is that there is a document type file created by the=
 w3c
>that defines the use of the tags (p, h1, etc.)  it also dictates that=
 <html>
>should be before <head> and that </head> should be before <body>, so it
>takes care of proper html structure and nesting.

Right, in fact it tells the user agent what "flavor" of HTML you are using=
=20
which could modify the way pages are rendered by a compliant user agent.

>you don't really need it
>so much anymore because browsers come with one these days, but it's not a
>bad idea to have anyhow.

Not true.  The Doctype Declaration is in fact more needed than ever as=20
already some browsers use it to render documents differently.  Mac IE 5.0=20
renders a page differently depending on what Doctype Declaration is used=20
(strict or transitional for example) or if one is used at all and the=20
Mozilla engine (NN 6) will apparently do the same thing.  So this is not=20
for some distant future, this is happening right now.  One also has to be=20
aware that an HTML document is not a valid document without a Doctype=20
Declaration and that is true for any flavor of HTML (from 2.0 to 4.01 and=20
XHTML 1.0).  The Doctype Declaration is also what a proper validator like=20
the W3C one will use to know what flavor of HTML (DTD) it should validate=20
your document against and report errors accordingly.  Like if one is using=
=20
any CSS or the name attribute in image tags for example,  one should use=20
the HTML 4.01 DTD.

>the doctype homesite gives me is this:
><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

I myself changed that in the default HomeSite 4.51 template to the more up=
=20
to date HTML 4.01 doctype declaration:

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">

>the doctype i got off your homepage is this:
><!DOCTYPE HTML PUBLIC "-//SoftQuad Software//DTD HoTMetaL PRO
>5.0::19981217::extensions to HTML 4.0//EN" "hmpro5.dtd">
>
>the difference?  as far as i know, the one i use goes to the w3c for the
>doctype.  the one you have gets a hotmetal pro doctype, which, from the
>looks of the statement, has its own extensions to the standard doctype.

The difference is that this is a proprietary DTD that is probably used to=20
"justify" the use of proprietary and invalid extensions in the Hot Metal=20
produced code.  It's just an assumption of course as I have never worked=20
with Hot Metal myself, just had the displeasure of cleaning up some sites=20
created in it before...  How a browser is supposed to deal with this DTD is=
=20
beyond me as the declaration doesn't even provide a full path to a copy of=
=20
the DTD.  If it's possible in Hot Metal, I'd change that default DTD to a=20
standard W3C doctype like the one I pasted above.  HTML is a fixed standard=
=20
(unlike XML where you're free to come up with your DTDs at will) and the=20
W3C controls those standards so it would be advisable to use their DTDs.  I=
=20
wonder what "special features" this "special" Hot Metal DTD enables you to=
=20
use and how well supported those are in existing browsers...

>i'm going to guess that it doesn't matter too much what you use, but
>personally would stick with the standards of the w3c (especially if=
 changing
>the doctype statement doesn't mess up your pages).

It does matter for the reasons stated above and after further investigation=
=20
it seems that NN 6 will indeed support Doctype switching and alter its=20
rendering of pages depending on what doctype is used.  I don't think the=20
Hot Metal doctype will fly very well in IE 5 Mac and NN 6 where the default=
=20
behavior is to default to a Strict DTD rendering when encountering an=20
unknown DTD thus disabling many backward compatible features in their HTML=
=20
rendering engines.  It's already hard enough to create widely accessible=20
and compatible pages without the makers of HTML tools making it even=20
harder.  That's why I stick to HomeSite and occasionally Dreamweaver=20
UltraDev.  The first one gives me total control and the second one leaves=20
my code alone...

HTH!

St=E9phane Bergeron

HWG hwg-techniques mailing list archives, maintained by Webmasters @ IWA