DTDs and syntax

Discussion in 'HTML' started by JimO, May 30, 2005.

  1. JimO

    JimO Guest

    If DTDs are supposed to enforce syntax rules, then why if I have the
    following DTD the html underneath works?


    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

    <b><i>italics bold</b></i>
    <img src="images/bacon.jpg">

    The first line should be
    <b><i>italics bold</i></b>
    The second line should be
    <img src="images/bacon.jpg" />

    Shouldn't I get an error message or the code just won't work?
     
    JimO, May 30, 2005
    #1
    1. Advertising

  2. JimO <joneill517###NoSpam###@earthlink.net> wrote:

    > If DTDs are supposed to enforce syntax rules, then why if I have the
    > following DTD the html underneath works?
    >
    >
    > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    >
    > <b><i>italics bold</b></i>
    > <img src="images/bacon.jpg">


    Works? Where?

    If you mean that it works your favorite browser, that's because it
    doesn't handle DOCTYPE declarations (the way it's supposed to).

    --
    David Håsäther
     
    David Håsäther, May 30, 2005
    #2
    1. Advertising

  3. On 30/05/2005 20:56, JimO wrote:

    > If DTDs are supposed to enforce syntax rules,


    The language - XML in this case - specifies the syntax rules. The DTD
    defines what elements are permitted in the document, and how they should
    (or should not) be used to structure the document. Neither enforce any
    rules.

    > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    >
    > <b><i>italics bold</b></i>
    > <img src="images/bacon.jpg">


    [snip]

    > Shouldn't I get an error message or the code just won't work?


    If you're serving this as application/xhtml+xml and the user agent is a
    'conforming user agent' (in the specification sense), then as I
    understand it, the software should flag that as syntax error and stop
    parsing. If it's also a validating parser (and it gets far enough into
    the document), it should notify you that the markup is invalid.

    If those conditions aren't true, the actions taken by a user agent are
    implementation dependent.

    Mike

    --
    Michael Winter
    Replace ".invalid" with ".uk" to reply by e-mail.
     
    Michael Winter, May 30, 2005
    #3
  4. "JimO" <joneill517###NoSpam###@earthlink.net> wrote:

    > If DTDs are supposed to enforce syntax rules, then why if I have the
    > following DTD the html underneath works?


    You seem to be throwing your question into more or less randomly chosen
    newsgroups - I just answered it in alt.html.dhtml. Apparently you don't
    want to get useful answers. Probably you should read a primer on HTML
    before proceeding further. Oh, and please do not fix your forged From
    field before you have a clue.

    --
    Yucca, http://www.cs.tut.fi/~jkorpela/
    Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html
     
    Jukka K. Korpela, May 31, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Miel Bronneberg

    DTDs, schema's and namespaces

    Miel Bronneberg, Sep 30, 2003, in forum: XML
    Replies:
    2
    Views:
    381
    Miel Bronneberg
    Sep 30, 2003
  2. Clifford W. Racz
    Replies:
    4
    Views:
    2,092
    Clifford W. Racz
    Feb 13, 2004
  3. Brandons of mass destruction

    XML, DTDs and getting the newspaper on the web

    Brandons of mass destruction, May 6, 2004, in forum: XML
    Replies:
    5
    Views:
    804
    Andy Dingley
    May 7, 2004
  4. Kza
    Replies:
    1
    Views:
    825
    amit161082
    Nov 8, 2006
  5. seven.reeds
    Replies:
    2
    Views:
    727
    seven.reeds
    Jul 1, 2007
Loading...

Share This Page