Re: html comments?

John Montbriand <montbriand@apple.com> wrote:

> re: http://www.w3.org/TR/WD-html40-970708/

This is very old Working Draft, you'd better look at:

    http://www.w3.org/TR/1999/REC-html401-19991224

> I have been looking for some information about placement of html
> comments.  Namely, <!-- ... --> style things in html text.  Now,
> such comments can be used to comment out sections of html, and
> and as such, they may contain html tags.  Now, I'm wondering,
> is the converse true?  i.e., can html comments be placed inside
> of html tags?  I've looked through he standards and there's no
> discussion of this.

The short answer is no.  Markup declarations (including comment
declaration) cannot appear inside markup.  You should refer to
the SGML standard for details, but in the case of XHTML, which
is written in XML syntax, XML 1.0 is very clear on this:

  2.5 Comments

    [Definition: Comments may appear anywhere in a document outside other
    markup; in addition, they may appear within the document type
    declaration at places allowed by the grammar. They are not part of
    the document's character data; an XML processor may, but need not,
    make it possible for an application to retrieve the text of comments.
    For compatibility, the string "--" (double-hyphen) must not occur
    within comments.] Parameter entity references are not recognized
    within comments.

  cf. http://www.w3.org/TR/2000/REC-xml-20001006#sec-comments

Regards,
-- 
Masayasu Ishikawa / mimasa@w3.org
W3C - World Wide Web Consortium

Received on Saturday, 19 May 2001 01:10:55 UTC