Re: Parsing of comments in LWP

Andrew McRae (mcrae@internet.com)
Wed, 15 May 96 12:56:57 -0400


[ Roy Fielding said: ]
>Nope, it isn't, though
>
>    <img  src="xxx" -- a nice picture --
>          alt="xxx" -- and an alternative text --
>    >
>
>may be (I'd have to look it up, but the book is in my office and I'm
>at home).

No, that's not valid either.

Basically: comments appear, delimited by '--', inside markup 
declarations. Markup declarations are things which begin with "<!". The 
only markup declaration you're likely to find in an HTML document is the 
DOCTYPE declaration at the top. (DTDs, on the other hand, are full of 
them ELEMENT, ENTITY, ATTLIST, and friends.)

The exception to that is the special "comment" markup declaration. It 
begins with "<!--", and may not contain anything but comments (and 
whitespace). So these are legal:

    <!-- foo, bar -->

    <!-- xyzzy --    >

    <!-- first --   -- second ---- third -->

but this is not

    <!-- comment -- not a comment -- comment -->

and things like this may or may not be, depending on whether they contain 
a multiple of 4 dashes:

    <!----------------------------->

Andrew.

PS. Those who know better are now invited to come and beat me over the 
head with a copy of Goldfarb.

--
Andrew McRae     <mcrae@internet.com>
The Internet Company