RE: DTD etc

Might I add that if you *must* adhere to W3C Priority 2 Guidelines (ie:
interpret as Standards, as is the situation here in Canada), then the DTD
*MUST* be present, per the HTML Specifications (http://www.w3.org/TR/html).

The DTD has been made mandatory in the spec since HTML 3.2 was finalized in
1997;  Html 4.01 has been "stable" since 1999.

WCAG Priority 2, 3.2 states: "Create documents that validate to published
formal grammars."  Thus, to satisfy this requirement, your document must
contain the DTD - as that is part of the published formal grammar. (I didn't
write it, I just read it.)

Most user agents today will interpret HTML with or without the DTD, so from
a practical "will it still work without" perspective, it's generally not an
issue.  When people ask me why they should be concerned with the inclusion
of the DTD, I usually use the following analogies:

	"(in Canada) Driving your car without wearing your seatbelt does not affect
the performance of the vehicle.  It still drives to and fro and gets you
where you need to be.  Most times, wearing the seatbelt does nothing for
you.  However, should you ever *require* the use of the seatbelt and you are
not wearing it, then what?  If you are stopped by the police, you will get a
ticket for not wearing it.  You have a choice, but with that choice comes
consequences."

The DTD defines the mark-up tags being used in your document; what they
signify, how they can be used, how they should be interpreted by the user
agent, etc.  I also use the following:

	"If I told you I left my lunch in my boot, you'd think I was nuts... but if
we were sitting in downtown London, England you'd know that I had left my
lunch in the trunk of my car... because the Boot in England is the Trunk in
North America"

Subtle differences in language can be confusing at the least, critically
important at the worst.  With the rapid emergence of *ML Languages it is not
beyond the realm of reasonability that defining the DTD may in fact be
crucial some day (very) soon.

So leaving it out (IMHO) courts disaster... it's like driving without the
seatbelt.


JF



>
> On Thu, 12 Sep 2002 gian@stanleymilford.com.au wrote:
>
> >Thanks... so does this mean...
> >1. That if doctype isn't in the first line then there's no point it
> >being there at all?
>
> More or less. The rules that apply are those for SGML or XML depending on
> whether you use HTML or XHTML (note that XML is a lot simpler than SGML).
>
> See the HTML specification: http://www.w3.org/TR/html for the latest
> (currently XHTML 1 published January 200 and revised August 2002) or
>
> http://www.w3.org/TR/html401/ for the latest HTML specification (published
> december 1999, a revision of HTML 4, originally published
> december 1997 and
> revised april 1998).
>
> GSW
> >2. Can the lang=en be specified in the BODY tag instead of the HTML tag?
>
> Yes. Then it is only your title any metadata that is in an
> unknown language.
>
> Chaals
>

Received on Thursday, 12 September 2002 08:22:12 UTC