W3C home > Mailing lists > Public > w3c-sgml-wg@w3.org > December 1996

Re: simplifying comments in SGML '97

From: Martin Bryan <mtbryan@sgml.u-net.com>
Date: Thu, 12 Dec 1996 12:25:39 +0000
Message-Id: <1.5.4.32.19961212122539.006a4868@mail.u-net.com>
To: Michael Sperberg-McQueen <U35395@UICVM.UIC.EDU>, W3C SGML Working Group <w3c-sgml-wg@w3.org>
If you define comment as:

>    [92] comment = como, SGML character*, comc
>
>    <add>
>    [92a] simple comment declaration =
>                     mdo, com, SGML character*, com, mdc
>    </add>

you cannot say
>
>    No markup is recognized in a comment, other than the com
>    delimiter that terminates it.

You must change com to comc, or retain com in place of como and comc.
(I'm not clear that como and comc buy you enough to invent two more
delimiters, with their associated parsing contexts)

The following note does not make sense if you use como and comc to delimit
comments:
 
>    1. A com delimiter not followed by an mdc delimiter will be
>    recognized in a comment (in a comment declaration or other
>    declaration) but not in a simple comment declaration.
>
Then there is option B!

>B.  Splitting the com delimiter.
>
>This proposal simply replaces the 8879 com delimiter with a pair of
>delimiters, como and comc (comment open and comment close).  Documents
>using 8879:1986 syntax have como = comc = com; in the RCS that's
>como = comc = '--'.  XML could allow -- within comments by setting
>como to '--*' and comc to '*--', to retain the general look and feel
>of current comments, and still allow '--' in the comment itself.
>Nested comments might also become possible, in SGML (and then in XML),
>or not.

Why go to all this fuss: simply change com in XML to "*--" or, better still
"**", and then -- becomes legal!

>
>Production 91 of 8879 could remaing the same as it now is; 92 would
>change.  We might have:
>
>  91 comment declaration = mdo, (comment, (s | comment)*)?, mdc
>  92 comment = como, SGML character*, comc

How does this approach restrict XML to a single comment?

>or (to allow nested comments)
>
>  92 comment = como, (SGML character | comment)*, comc

So now I can mix text with comments e.g.
<!*-- Here is a --comment-- with *-- and --* --embedded-- within it --*>
How very clever!

>Note:  If this is what we propose to WG8, 

it will be rejected!

>the XML spec should probably
>change *now* to use these delimiters, replacing production 21 with
>
>  [21] Comment ::= '<!--*' [-]* ('-' [-]+)* '*-->'
>
>Advantages: this seems relatively simple and relatively compatible
>with the look and feel of 8879 as a whole.  Disadvantages:  it
>doesn't allow the SGML parser to enforce XML's rules.

And won't work as it fails to make -- legal, which seemed to be the whole
point of this useless exercise.!
----
Martin Bryan, The SGML Centre, Churchdown, Glos. GL3 2PU, UK 
Phone/Fax: +44 1452 714029   WWW home page: http://www.u-net.com/~sgml/
Received on Thursday, 12 December 1996 07:26:10 EST

This archive was generated by hypermail pre-2.1.9 : Wednesday, 24 September 2003 10:03:48 EDT