Re: Beta: Fatal Error: No DOCTYPE specified!

Terje Bless:

> Bertilo Wennergren <bertilow@gmx.net> wrote:

>>Well, maybe I missed some important context here, but the DOCTYPE
>>declaration does not and should not appear at the first line, nor at the
>>very beginning of an XHTML document that includes an XML declaration.

> Ok, how would you suggest I put it then?

It's not easy since the matter is somewhat complicated.

Perhaps something like this could do:

   return <<".EOF.";
     <p>
       You should place a DOCTYPE declaration as the very first thing
       in your HTML document - unless you use XHTML with an xml
       declaration, then you put the xml declaration first, and the
       document type declaration after that.
     </p>

     <p>
       <a href="examples.html">Show me some examples!</a>
     </p>
 .EOF.
 }
 __END__

The examples, in a separate page, should show both HTML 4.01 (with an
xml declaration, of course) and XHTML 1.0 Strict with an xml
declaration. Then you could add an explanation of the risks involved
with using xml declaration, but that matter is complicated since there
are some important ifs and buts about character encodings involved.

Perhaps a link to a longer explanation would be a nice solution. Such
esoterica as BOMs could be left to the long full text.

>>"May want to avoid" is not a recommendation against including,
>>especially in the light of the first quotation.

> Do I need to tell you that I'm not overly fond of Appendix C of the XHTML
> 1.0 Recommendation? :-)

I could agree.

> Still, it's there and the fact of the matter is that there are browsers out
> there that choke on it.

Indeed. _I_ would recommend leaving out xml declarations in all docs
served to todays ordinary browsers, but to do that one must either use
UTF-8, or make sure that the encoding is properly declared in the HTTP
header, and many people can't do that. To those that can't do all those
things right, I'd recommend using HTML 4.01. And then there are actually
very good arguments for using XHTML only when you can serve it as
"application/xhtml+xml"...

> I don't particulaly care either way, so if you talk
> fast enough I may be convinced. OTOH, what Jim wrote in another message in
> this thread also counts rather heavily. So "Let's you and him fight!". :-)

I don't think there is much to fight about.

> Seriously though, the reason the XML Decl isn't there is probably the same
> as what prompted that statement in Appendix C. At the moment I feel the
> need to avoid tripping up these "legacy browsers" outweighs the need to
> "look to the future", but I'm perfectly willing to be convinced otherwise.

Then the solution is HTML 4.01. That they can handle with only minor
problems.

-- 
Bertilo Wennergren <bertilow@gmx.net> <http://www.bertilow.com>

Received on Friday, 25 October 2002 13:52:47 UTC