List Info

Thread: comment syntax




comment syntax
user name
2007-01-06 00:26:46
On Fri, 05 Jan 2007 14:35:23 -0800, William M. Brack wrote:

> See the XML spec - http://www.w3.
org/TR/xml/#sec-comments - which
> basically says that any "normal" character
except '-' may go at positions
> X and Y (i.e. white space is not required).
> 

[...]

Thanks for this explanation.  At the site you reference,
I see:
   Comments may appear anywhere in a document
   outside other markup; ...

Consider:

   <MyDoc>
      <!--Here is my special tag-->
      <MySpecialTag>
         stuff in tag
      </MySpecialTag>
   </MyDoc>

Now is a sense, the comment is within markup, being between
the two MyDoc tags.  I assume that this is NOT what they
mean,
and that the comment is ok.  Right?

Thanks again,
Mike.


_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xmlgnome.org
http://mai
l.gnome.org/mailman/listinfo/xml
comment syntax
user name
2007-01-06 01:17:16
On Fri, 2007-05-01 at 19:26 -0500, Mike - EMAIL IGNORED
wrote:
> ,
> I see:
>    Comments may appear anywhere in a document
>    outside other markup; ...
> 
> Consider:
> 
>    <MyDoc>
>       <!--Here is my special tag-->
>       <MySpecialTag>
>          stuff in tag
>       </MySpecialTag>
>    </MyDoc>
> 
> Now is a sense, the comment is within markup, being
between
> the two MyDoc tags.  I assume that this is NOT what
they mean,
> and that the comment is ok.  Right?

Right.  The prohibition is intended to exclude things like
<MyDoc -- this would be an SGML comment but is illegal in
XML -->
or,
<!ELEMENT a --* represent the attick of an old house --
   (dirt|rafter|chest)*
>
also legal in SGML but not allowed in XML.

At one point we had <!--* . . . . *--> as an XML
comment,
with the asterisks required, but people felt it to be
too verbose.  If we had done this, we could have allowed
"--" inside a comment (with a small change to SGML
that
was in fact possible) but as things stand, an XML
comment can't contain "--" at all.

Basically, you can put a comment wherever you can
put an element or (in a DTD or the internal
document type declaration subset) an <!ELEMENT...>
declaration.
Do not put a comment before the XML declaration, though,

Liam

-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/Peop
le/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org www.advogato.org

_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xmlgnome.org
http://mai
l.gnome.org/mailman/listinfo/xml
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )