W3C home > Mailing lists > Public > www-validator@w3.org > March 2002

Re: Hyphens in comments

From: Christian Smith <csmith@barebones.com>
Date: Fri, 22 Mar 2002 11:05:18 -0500
To: www-validator@w3.org
cc: Olaf Buddenhagen <olafbuddenhagen@gmx.net>
Message-ID: <20020322110519-r01050000-B2474180-3D84-11D6-957B-EBFCDCDF6B2A-0921-0108@>
On 03/22/2002 at 03:12, olafbuddenhagen@gmx.net (Olaf Buddenhagen) wrote:

> Hi,
> > It is allowed if you are careful and ensure that you
> > use multiples of 4 hyphens and only put content in
> > between matched pairs.
> > 
> > <---- --this is valid-- ---->
> > 
> > <----this is not---->
> Well, I know what is valid in SGML... Only I thought that
> HTML implements only a subset of SGML, and not everything
> valid in SGML is also valid in HTML... That's an awkward
> situation:

How so?

I was sloppy above and I apologize.

Yes, HTML is an SGML based language. As such it is possible
to do things in SGML which are not valid in HTML, but it is
not possible to do anything in HTML which is not valid SGML.

This <!---- --this is valid-- ----> is a valid HTML comment
composed of an SGML declaration containing 3 comments, two
of which are empty and one of which contains the string
"this is valid".

This <!----this is not----> is an SGML delaration which
contans two empty comments plus some text which is inside
the decaration and which is not within a comment. As such
it is not a valid "HTML comment" and is going to generate
errors in a context where it is expected to be one.

This <!------> is not a complete "HTML comment". It is the
start of an SGML declaration followed by an empty comment
followed by the start of a second comment which contain the
string ">" as well as any text that comes after this upto
the next instance of "--" in the document.

This is all very confusing which is why it is often
recommended (but not required) that HTML comments begin
with exactly "<!--", end with exactly "-->" and never
contain the string "--".

> Either we have to implement full valid SGML comment
> parsing, and ignore the fact that it's probably not what
> the author intended 

That is indeed what you should to do.

> -- without even the possiblitiy of issuing a warning. Or
> else we presumably violate the standard, and possibly
> complain about valid HTML :-(

I see no possible benefit to this course of action. 

Received on Friday, 22 March 2002 11:05:21 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 1 March 2016 14:17:32 UTC