Re: DTD problem, or validator problem?

Bjoern Hoehrmann wrote:
> http://www.htmlhelp.com/tools/validator/ will
> however _warn_ you, that you are using a
> net-enabled start tag.



Ahh.... Thanks for the vocab word :)

I found a nice discussion of this at

    http://www.sgml.u-net.com/book/sgml-9.htm

including an interesting example shown below (with whitespace added). It
may be old-hat to the more SGML and XML-savvy folks on the list, but
this sort of thing was completely new to me:

    <P/
       Nested
       <EM/net-enabling start-tags/
       are permitted, as this example shows.
    /

This still leaves me curious about why the validator is not giving any
errors. Take the following document:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
    <head><title>test</title></head><body><br /><hr /></body>
</html>


As I understand it, the first slash (in the BR) says "I'm putting the
following inside a BR container" and then we put a greaterthan sign in
the BR container followed by an HR... but the second slash (in the HR)
says "I'm putting the following in the HR container" and we put a
greater than sign in the HR container. Then we close the body and the
HTML, never closing the HR and the BR.

So, it might be parsed as something like this, only without the closing
/br and /hr tags:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
    <head><title>test</title></head>
    <body>
        <br>
            &gt;
            <hr>
                &gt;
            </hr>    
        </br>
    </body>
</html>


...but the DTD says that BR and HR are empty containers. So, why don't
we get an error for trying to put stuff into BR and HR containers? Or
does the DTD saying that they're empty tell a parser to interpret the
net-enabled start tag differently, and not look for any container
contents at all, resulting in an interpretation something like:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
    <head><title>test</title></head>
    <body>
        <br>
        &gt;
        <hr>
        &gt;
    </body>
</html>


That sounds like reasonable behavior for a DTD saying start tag required
and end tag forbidden, and it looks consistant with the "Parse Tree"
output of the validator. I can now rest with my curiosity fully-satisfied.

Thanks, everyone :)

-matt

Received on Thursday, 16 August 2001 12:02:19 UTC