tags:

views:

97

answers:

7

Structure <!-- some text --> is a comment in XML, but I would like to put this text inside another tag and I don't want it to be treated as a comment, just as text (I need it in visual studio's class's comment), like this:

<summary>
   (...) that contains
   sections marked with <!--[section_name]--> at the beginning.
</summary>

How do I do this?

+2  A: 

Use CDATA or escape the characters using &gt; or &lt; for < and > respectively.

ng
visual studio doesn't care about CDATA section in xml comment (just treats it as another tag), but < and > worked. thanks
agnieszka
A: 

Wrap the contents of the element in a CDATA section. This tells the parser to treat the contents as literal.

skaffman
+1  A: 

Take a look at CDATA-term: http://en.wikipedia.org/wiki/CDATA

<summary>
    <![CDATA[
    (...) that contains
    sections marked with <\!--[section_name]--> at the beginning.
    ]]>
</summary>
Philippe Gerber
A: 

You should wrap the text inside a CDATA tag:

<summary>
<![CDATA[   (...) that contains
   sections marked with <!--[section_name]--> at the beginning.]]>
</summary>
Philippe Leybaert
A: 

Use code like this:

<xml>
  <![CDATA[

    <!-- comment treated as plain text -->

  ]]>
</xml>
Gerco Dries
A: 

Either escape the characters...

<summary>Blah blah &lt;!-- not a comment --&gt; blah.</summary>

...or wrap them inside a PCDATA section:

<summary><![CDATA[Blah blah <!-- blah -->]]></summary>
grawity
A: 
kdgregory