Why is here no wc3 validation error?

Discussion in 'HTML' started by Knut Krueger, Jun 2, 2007.

  1. Knut Krueger

    Knut Krueger Guest

    Hi all,
    why is the code reported as valid?
    IE and Opera will display nothing without the > after the link

    Regards Knut

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
    "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <meta content="text/html; charset=windows-1252" http-equiv="content-type" >

    <title>image problem</title>
    </head>
    <body>
    <div>
    <A HREF="http://www.w3.org" <img
    src="http://www.w3.org/Icons/WWW/w3c_home_nb" alt="wc3"/> </A>
    </div>

    </body>
    </html>
     
    Knut Krueger, Jun 2, 2007
    #1
    1. Advertising

  2. Knut Krueger

    John Guest

    "Knut Krueger" <> wrote in message
    news:f3rsrn$qu6$00$-online.com...
    > Hi all,
    > why is the code reported as valid?
    > IE and Opera will display nothing without the > after the link
    >
    > Regards Knut
    >
    > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
    > "http://www.w3.org/TR/html4/strict.dtd">
    > <html>
    > <head>
    > <meta content="text/html; charset=windows-1252" http-equiv="content-type"
    > >

    >
    > <title>image problem</title>
    > </head>
    > <body>
    > <div>
    > <A HREF="http://www.w3.org" <img
    > src="http://www.w3.org/Icons/WWW/w3c_home_nb" alt="wc3"/> </A>
    > </div>
    >
    > </body>
    > </html>


    Why the forward slash after ("wc3") I'm no expert but that just doesn't look
    right to me. I'm only guessing here until someone comes along that may be of
    more help to you.
     
    John, Jun 2, 2007
    #2
    1. Advertising

  3. Knut Krueger

    John Hosking Guest

    Knut Krueger wrote:
    > Hi all,
    > why is the code reported as valid?
    > IE and Opera will display nothing without the > after the link


    I don't know. Maybe Jukka or Ben or somebody experienced in reading DTDs
    can explain why it's allowed.

    I pasted your code into the "Validate by Direct Input" box at
    http://validator.w3.org/ and found that the code is indeed deemed to be
    valid. Also valid is this simpler variant:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
    "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <title>More of a Parse Question</title>
    </head>
    <body>
    <p>
    <A </A>
    </p>
    </body>
    </html>

    I can only guess that this is an instance of one of those little-known
    auto-terminating tags (although it doesn't seem to be a proper "null end
    tag") that seem to work because they are rooted in SGML, but which
    nobody (like, say, browser developers) knows about.

    Sorry I can't be of more help. I'm interested in knowing the answer, too.

    --
    John
     
    John Hosking, Jun 2, 2007
    #3
  4. Hello,

    Knut Krueger wrote:
    > why is the code reported as valid?
    > IE and Opera will display nothing without the > after the link
    >
    > Regards Knut
    >
    > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
    > "http://www.w3.org/TR/html4/strict.dtd">
    > <html>
    > <head>
    > <meta content="text/html; charset=windows-1252" http-equiv="content-type"
    > >

    >
    > <title>image problem</title>
    > </head>
    > <body>
    > <div>
    > <A HREF="http://www.w3.org" <img
    > src="http://www.w3.org/Icons/WWW/w3c_home_nb" alt="wc3"/> </A>
    > </div>
    >
    > </body>
    > </html>


    The '<A ... ' followed by '<img ...' is a so-called 'unclosed start-tag'
    [1], which is valid SGML syntax, but not supported by 'tag-soup' parsers
    found in browsers.
    There's also a XMLish '<img .. />' tag in there, which is valid in this
    context, but - when parser by the SGML rules - not what you want, though
    tag-soup parsers treat it the way you want it. '<img .. />' equals '<img ..
    >>' where the second '>' is parsed as character data. Tag-soup parsers

    probably treat the '/' as a syntax error which is silently ignored.

    Reporting such things is beyond the scope of a markup validator, though it
    may be of great help for web authors.

    HTH

    [1]: If the start-tag is immediately followed by a TAGO '<' or STAGO '</',
    you may omit the TAGC '>'.


    --
    Benjamin Niemann
    Email: pink at odahoda dot de
    WWW: http://pink.odahoda.de/
     
    Benjamin Niemann, Jun 2, 2007
    #4
  5. Knut Krueger wrote:
    > Hi all,
    > why is the code reported as valid?
    > IE and Opera will display nothing without the > after the link
    >
    > Regards Knut
    >
    > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
    > "http://www.w3.org/TR/html4/strict.dtd">
    > <html>
    > <head>
    > <meta content="text/html; charset=windows-1252" http-equiv="content-type" >
    >
    > <title>image problem</title>
    > </head>
    > <body>
    > <div>
    > <A HREF="http://www.w3.org" <img
    > src="http://www.w3.org/Icons/WWW/w3c_home_nb" alt="wc3"/> </A>
    > </div>
    >
    > </body>
    > </html>


    http://www.is-thought.co.uk/book/sgml-9.htm#Unclosed
     
    Harlan Messinger, Jun 2, 2007
    #5
  6. Knut Krueger

    dorayme Guest

    In article <f3s640$kfn$>,
    Benjamin Niemann <> wrote:

    > Hello,
    >
    > Knut Krueger wrote:
    > > why is the code reported as valid?
    > > IE and Opera will display nothing without the > after the link
    > >
    > > Regards Knut
    > >
    > > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
    > > "http://www.w3.org/TR/html4/strict.dtd">
    > > <html>
    > > <head>
    > > <meta content="text/html; charset=windows-1252" http-equiv="content-type"
    > > >

    > >
    > > <title>image problem</title>
    > > </head>
    > > <body>
    > > <div>
    > > <A HREF="http://www.w3.org" <img
    > > src="http://www.w3.org/Icons/WWW/w3c_home_nb" alt="wc3"/> </A>
    > > </div>
    > >
    > > </body>
    > > </html>

    >
    > The '<A ... ' followed by '<img ...' is a so-called 'unclosed start-tag'
    > [1], which is valid SGML syntax, but not supported by 'tag-soup' parsers
    > found in browsers.
    > There's also a XMLish '<img .. />' tag in there, which is valid in this
    > context, but - when parser by the SGML rules - not what you want, though
    > tag-soup parsers treat it the way you want it. '<img .. />' equals '<img ..
    > >>' where the second '>' is parsed as character data. Tag-soup parsers

    > probably treat the '/' as a syntax error which is silently ignored.
    >
    > Reporting such things is beyond the scope of a markup validator, though it
    > may be of great help for web authors.
    >


    BBedit text editor reports

    Unencoded entity found; "<" needs to be encoded as "&lt;".

    Document type doesn't permit empty XML element; "<img/>".

    Close element "</a>" found but element wasn't open.

    The iCab browser, which refuses to show anything on the page at
    all, reports:

    HTML error (12/57): The attribute "<IMG" in tag <A> is not
    allowed.
    HTML error (12/57): The attribute "SRC" in tag <A> is not allowed.
    HTML error (12/57): The attribute "ALT" in tag <A> is not allowed.
    HTML error (12/57): Illegal character "/" in tag.

    Opera refuses too.

    Safari happily displays the logo, so too does the innocent and
    good old Mac IE 5

    --
    dorayme
     
    dorayme, Jun 2, 2007
    #6
    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. Terje Sæternes

    wc3 error

    Terje Sæternes, May 19, 2004, in forum: HTML
    Replies:
    10
    Views:
    1,070
    SpaceGirl
    May 19, 2004
  2. Replies:
    10
    Views:
    774
    Adrienne Boswell
    Jun 10, 2006
  3. Mr. SweatyFinger

    why why why why why

    Mr. SweatyFinger, Nov 28, 2006, in forum: ASP .Net
    Replies:
    4
    Views:
    996
    Mark Rae
    Dec 21, 2006
  4. Mr. SweatyFinger
    Replies:
    2
    Views:
    2,266
    Smokey Grindel
    Dec 2, 2006
  5. Just Me
    Replies:
    7
    Views:
    445
    Just Me
    Sep 22, 2007
Loading...

Share This Page