title: How do I add CDATA to an xml file?
body: <p>I have an existing xml file that holds notifications I want to display on my site. A snippet follows:</p>
  
  <pre><code>&lt;contents&gt;
    &lt;item&gt;
      &lt;![CDATA[
          &lt;a style="font-weight: bold;" href="http://engadget.com"&gt;Engadget&lt;/a&gt;
      ]]&gt;
    &lt;/item&gt;
    &lt;item&gt;
      &lt;![CDATA[
          &lt;a style="font-weight: bold;" href="http://cnn.com"&gt;CNN&lt;/a&gt;
      ]]&gt;
    &lt;/item&gt;
  &lt;/contents&gt;
  </code></pre>
  
  <p>I'm trying to open this document and add new "items" to it, but I can't:</p>
  
  <pre><code>        foreach (string s in notifications)
          {
              XmlElement newElement = doc.CreateElement("item");
              newElement.InnerXml = "&amp;lt;![CDATA[ " + s + " ]]&gt;";
              doc.DocumentElement.SelectNodes("/contents")[0].AppendChild(newElement);
          }
  </code></pre>
  
  <p>notifications is a List that I'm using to store the links. The error I'm getting is:</p>
  
  <p><em>']]>' is not allowed in character data.</em></p>
  
  <p>The notifications need to contain HTML, because of the way I'm displaying it. Thanks for looking, guys.</p>