Re: Simple(?) question on obscure comments detail

   First tried to ask on www-talk, but unfortunately no one could offer
   an authoritative answer yet there..

   RFC 1866 defines an HTML comment tag as "<!" followed by 0 or more
   comments followed by ">". A comment is defined as "anything but
   the '--' sequence, enclosed in '--'". Now, is the following tag
   a valid comment?

   <!-- hello--->

Yes.

The <! is a sequence which signals that what follows is a markup
_declaration_, not a piece of markup itself. It's what you use for
element and entity declarations in the writing of a DTD (read the HTML
DTD to see how). When followed by a comment enclosed in double
hyphens, it becomes a comment declaration. 

   Should a parser accept the first '-' of the three as part of the
   contents, or should it barf on the "->" stuff outside the first
   comment?

What three? I count four hyphens in the example. A parser must accept
the example you have given as a valid comment, provided it is validly
located in the DTD or instance. There's nothing there to barf at.

///Peter

Received on Thursday, 19 September 1996 20:43:16 UTC