Re: Beta: Fatal Error: No DOCTYPE specified!

Bertilo Wennergren <bertilow@gmx.net> wrote:

>Terje Bless <link@pobox.com>:
>>Bjoern Hoehrmann <derhoermi@gmx.net> wrote:
>
>>>4) The phrase talks about a "first line", while the document type
>>>declaration in the example takes two lines
>>Yeah, thanks, good catch! I'll fix it ASAP. How does "At the very
>>beginning of your document" sound to you?
>
>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? I don't particularly care how it's
phrased so long as it's clear and can be understood by the people most
likely to omit a DOCTYPE. A long sentence with three conditionals (iff XML
Decl, and not BOM, then foo) ain't exactly friendly. :-)

Really! If anyone has suggestions for how that should be phrased, please
(please!) do send me a "patch" for it. Here is the original snipped
straight from the current code in CVS:

#
# Print HTML explaining why/how to use a DOCTYPE Declaration.
sub doctype_spiel {
  return <<".EOF.";
    <p>
      You should place a DOCTYPE declaration as the very first thing
      in your HTML document. For example, for a typical <a
      href="http://www.w3.org/TR/xhtml1/">XHTML 1.0</a> document:
    </p>
    <pre>
      &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
      &lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"&gt;
        &lt;head&gt;
          &lt;title&gt;Title&lt;/title&gt;
        &lt;/head&gt;

        &lt;body&gt;
          &lt;!-- ... body of document ... --&gt;
        &lt;/body&gt;
      &lt;/html&gt;
    </pre>
    <p>
      For XML documents, you may also wish to include an "XML Declaration"
      even before the DOCTYPE Declaration, but this is not well supported
      in older browsers. More information about this can be found in the
      <a href="http://www.w3.org/TR/xhtml1/">XHTML 1.0</a> Recommendation.
    </p>
.EOF.
}
__END__

Note that this is updated after Björn's comments earlier.


>>XHTML 1.0 also reccomends against including [an XML Declaration] in
>>"Appendix C" documents.
>
>Does it?
>
>  XHTML document authors are strongly encouraged to use XML declarations
>  in all their documents (http://www.w3.org/TR/xhtml1/)
>
>In Appendix C we find this:
>
>  For compatibility with these types of legacy browsers, you may want to
>  avoid using processing instructions and XML declarations.
>
>"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? :-)

Still, it's there and the fact of the matter is that there are browsers out
there that choke on it. 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!". :-)

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.


-- 
"I don't want to learn to manage my anger;
 I want to FRANCHISE it!" -- Kevin Martin

Received on Friday, 25 October 2002 11:24:02 UTC