Re: [xml] comment syntax



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/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org www.advogato.org




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]