W3C home > Mailing lists > Public > www-talk@w3.org > September to October 1996

Re: Simple(?) comments question...

From: Chris Ridd <C.Ridd@imc.exec.nhs.uk>
Date: Wed, 18 Sep 1996 12:56:05 +0100
Message-Id: <323FE355.54D6@imc.exec.nhs.uk>
To: S.N.Brodie@ecs.soton.ac.uk
Cc: www-talk@w3.org
S.N.Brodie@ecs.soton.ac.uk wrote:
> A further question is, what is the parser to make of any such text not
> held between the comment markers?  eg.
> <!-- My Comment -- h1 -- start a level one heading? -- align=center -- put
> it in the middle? -->

According to nsgmls, it isn't legal. It would be legal if you removed
the "h1" and the "align=center", because you aren't allowed to have
anything between end comment tokens and start comment tokens. It would
also be legal if you doubled all the "--"s inside, viz:

<!-- My Comment ---- h1 ---- start a level one heading? ----
align=center ---- put it in the middle? -->

Joe English has a good page about this, and describes comment parsing
much more clearly than I can:


> My parser ignores such things.  Should it?

I guess so, bearing in mind it is coping with illegal HTML.

> comment has not helped.  This issue has forced me to spend more time
> working on the comment parsing in my (custom written in C) parser than
> any other part of the HTML syntax. :-(

Here's an interesting one to throw at your parser:

<P>Some <!-- <A TITLE="---->" HREF="secret.html">secret</A> --> text.

The anchor title should end a comment and immediately start a second one

Received on Wednesday, 18 September 1996 07:56:47 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:32:59 UTC