W3C home > Mailing lists > Public > www-validator@w3.org > May 2004

Re: [VE][53] New Error Message Suggestion

From: Jukka K. Korpela <jkorpela@cs.tut.fi>
Date: Mon, 24 May 2004 13:51:36 +0300 (EEST)
To: "'www-validator@w3.org'" <www-validator@w3.org>
Message-ID: <Pine.GSO.4.58.0405241343020.29041@korppi.cs.tut.fi>

On Mon, 24 May 2004, Kerr Edward wrote:

> I obtained the following error:
>
> Line 100, column 12: invalid comment declaration: found name start character
> outside comment but inside comment declaration
>
> <!-- ------ Main data table starts here ------ -->
>
> The M was in red.

Technically, that's how things are by SGML rules. I don't know how it
could be explained simply, since there is a widespread misunderstanding on
what a comment is.

> I was understand that one could put any characters in a comment.

Well, as long as they don't contain two consecutive hyphens, since "--"
ends a comment.

What is commonly called a comment is actually a comment declaration, which
may contain one or more comments. The construct
<!-- ------ Main data table starts here ------ -->
actually contains several comments (again, by SGML rules; browsers are
known to have broken parsers). The first one is
-- --
and the second one is
----
and the the problems start.

In practical terms, the only comment declaration syntax that should ever
be used in HTML is one that starts with <!-- and ends with --> and does
not contain any consecutive hyphens between them, or any hyphen
immediately before the ending -->. The SGML rules permit other variants
as well, but the rules do _not_ correspond to intuitive expectations.

To use a comment declaration that "stands out" as a divider, don't use
---- but e.g. **** or ____.

-- 
Jukka "Yucca" Korpela, http://www.cs.tut.fi/~jkorpela/
Received on Monday, 24 May 2004 06:51:38 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 25 April 2012 12:14:13 GMT