Doctype quickie!

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • CJM

    Doctype quickie!

    Are DOCTYPE statements case sensitive?

    I cant remember where, but I'm sure I read that case *does* matter...

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

    ....will work [ie trigger 'Standards mode'], but...

    <!doctype html public "-//w3c//dtd html 4.01//en"
    "http://www.w3.org/tr/html4/strict.dtd>

    ...won't.

    Cheers

    Chris


  • Steve Pugh

    #2
    Re: Doctype quickie!

    "CJM" <cjmwork@yahoo. co.uk> wrote:
    [color=blue]
    >Are DOCTYPE statements case sensitive?[/color]

    Parts of them are...

    The root element (i.e. the HTML) is case senstive in so far as the
    root element itself might be case sensitive. i.e. in XHTML the root
    element must be html because all element names in XHTML are lower
    case; but in HTML it makes no difference.

    The Formal Public Identifier (the part in quotes) is also case
    sensitive.

    If you include the URL then that's as case sensitive or insensitive as
    any other URL.

    As far as I'm aware the rest is not case sensitive.
    [color=blue]
    >I cant remember where, but I'm sure I read that case *does* matter...
    >
    >eg.
    ><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
    >"http://www.w3.org/TR/html4/strict.dtd>
    >
    >...will work [ie trigger 'Standards mode'], but...
    >
    ><!doctype html public "-//w3c//dtd html 4.01//en"
    >"http://www.w3.org/tr/html4/strict.dtd>
    >
    >..won't.[/color]

    That second one is wrong as the FPI should be uppercase as in the
    first example.

    Doctype sniffing is another matter as their we're dealing with
    browsers and their peculiarities rather than SGML/XML rules.

    Steve

    --
    "My theories appal you, my heresies outrage you,
    I never answer letters and you don't like my tie." - The Doctor

    Steve Pugh <steve@pugh.net > <http://steve.pugh.net/>

    Comment

    • Jukka K. Korpela

      #3
      Re: Doctype quickie!

      "CJM" <cjmwork@yahoo. co.uk> wrote:
      [color=blue]
      > Are DOCTYPE statements case sensitive?[/color]

      The part that is in quotation marks is case sensitive. The rest isn't.
      [color=blue]
      > I cant remember where, but I'm sure I read that case *does* matter...[/color]

      Well, I'm afraid the HTML specification doesn't tell you this, and various
      tutorials are even less informative. In principle, you are supposed to know
      this from SGML.
      [color=blue]
      > eg.
      > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
      > "http://www.w3.org/TR/html4/strict.dtd>[/color]

      There's a missing quotation mark near the end. Otherwise, the incantation is
      correct.
      [color=blue]
      > ...will work [ie trigger 'Standards mode'], but...[/color]

      Umm... will be mishandled by browsers, which abuse it and make (wrong)
      guesses on author's intentions, completely missing the point of document
      type definitions.

      If they take SGML seriously, they do that just by accident, so what is
      _right_ by international standards is of little consequence here. But
      apparently wowsers accidentally treat the quoted strings as case sensitive -
      probably just because it's a little easier, or because nobody gave the issue
      a thought.
      [color=blue]
      > <!doctype html public "-//w3c//dtd html 4.01//en"
      > "http://www.w3.org/tr/html4/strict.dtd>
      >
      > ..won't.[/color]

      It is malformed, since there is no catalogued DTD under the name
      "-//w3c//dtd html 4.01//en".

      --
      Yucca, http://www.cs.tut.fi/~jkorpela/
      Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

      Comment

      • CJM

        #4
        Re: Doctype quickie!

        Thanks for that...

        The problem is made worse for me because I'm developing in VS.NET; it has a
        hand feature, which asks you whether you want HTML tags and attributes in
        Uppercase/Lowercase/As Typed - I chose Lowercase to be forward-looking to
        XHTML.

        Unfortunately when I cut & paste my DOCTYPEs, it renders it ALL as
        lowercase...whi ch made for a bit of head-scratching when my pages were
        render in an unexpected way!

        Cheers

        CJM


        Comment

        • Anne van Kesteren

          #5
          Re: Doctype quickie!

          CJM wrote:[color=blue]
          > Thanks for that...
          >
          > The problem is made worse for me because I'm developing in VS.NET; it has a
          > hand feature, which asks you whether you want HTML tags and attributes in
          > Uppercase/Lowercase/As Typed - I chose Lowercase to be forward-looking to
          > XHTML.[/color]

          Are empty tags also rendered correctly: <br/>? Otherwise it doesn't make
          much sense I think.
          [color=blue]
          > Unfortunately when I cut & paste my DOCTYPEs, it renders it ALL as
          > lowercase...whi ch made for a bit of head-scratching when my pages were
          > render in an unexpected way![/color]

          E-mail the developers of that programm. The only thing I know about it,
          is that it comes from MS, but maybe there is some option to add that
          doctype later?
          [color=blue]
          > Cheers
          >
          > CJM
          >
          >[/color]


          --
          Anne van Kesteren
          <http://www.annevankest eren.nl/>

          Comment

          Working...