Re: Comment Declarations

Glenn Adams (
Mon, 22 May 95 11:45:59 EDT

Date: Mon, 15 May 1995 17:16:13 -0400
From: "Daniel W. Connolly" <>

>Is it possible to correct the specification of comment declarations
>in 2.0 so that it matches ISO 8879?

Would you care to give it a whirl?


****** CURRENT TEXT ******

| To include comments in an HTML document that will be
| eliminated in the mapping to terminals, surround them with
| `<!--' and `-->'. After the comment delimiter, all text up
| to the next occurrence of `-->' is ignored. Hence comments
| cannot be nested. White space is allowed between the closing
| `--' and `>', but not between the opening `<!' and `--'.
| For example:
| <HEAD>
| <TITLE>HTML Guide: Recommended Usage</TITLE>
| <!-- $Id: html-sgml.sgm,v 1.4 1995/05/06 01:44:46 connolly Exp $ -->
| </HEAD>
| NOTE - Some historical HTML implementations incorrectly
| consider any `>' character to be the termination of a
| comment.

****** REVISED TEXT ******


An HTML document may contain comments whose contents shall be ignored
by user agents. Comments may occur in two forms: as simple comments,
and as comment declarations. Simple Comments

A simple comment is delimited on either side by '--'. Simple comments
do not nest. Simple comments may only occur within markup and may appear
wherever a parameter separator would occur.

For example:

-- Use Experimental DTD --

A simple comment is terminated only by '--' or the end of the
entity, whichever comes first. In particular, no other delimiters
such as '>' should be recognized in a simple comment.

NOTE - a parameter separator currently appears in an HTML
document only within markup declarations, which, at the
current time, is limited to the document type declaration.

NOTE - separators occurring within descriptive markup, e.g., in
tags, may not contain simple comments. Comment Declarations

When a comment is required in a context where other markup is not used,
a comment declaration may be used; for example, within the content of
an element.

A comment declaration is composed of a markup declaration open
delimiter '<!' followed by one or more simple comments separated
by whitespace and terminated by a markup declaration close delimiter '>'.

No whitespace may appear between the '<!' and the start of the first
simple comment; however whitespace may appear after the last simple
comment and before the closing delimiter '>'.

For example:

<!-- This comment declaration contains one simple comment -->

<!-- This comment declaration --
-- contains --
-- four simple comments --
-- and has optional whitespace after the last simple comment --

<! -- This comment declaration is illegal due to whitespace before
the first simple comment -->

<!-- This comment declaration doesn't terminate properly >
<P>and this seeming paragraph element should be treated as part of
the comment -- but this text will not since the preceding '--'
will terminate the ill-formed simple comment within the comment
declaration and since the text starting with "but this text..."
is not whitespace.

<!-- The following comment declaration is illegal: -->


<!-- since it is equivalent to the following: -->

<!-- -- ->

<!-- note that the first contained simple comment is well-formed
but the second is not --

****** END OF TEXT ******