using System;
using System.IO;
using System.Xml;public class Sample
{
  public static void Main()
  {
    XmlDocument doc = new XmlDocument();
    doc.LoadXml("<book genre='novel' ISBN='1-861001-57-5'>" +
                "<title>Pride And Prejudice</title>" +
                "</book>");    //Create a CData section.
    XmlCDataSection CData;
    CData = doc.CreateCDataSection("All Jane Austen novels 25% off starting 3/23!");        //Add the new node to the document.
    XmlElement root = doc.DocumentElement;
    root.AppendChild(CData);  
        
    Console.WriteLine("Display the modified XML...");        
    doc.Save(Console.Out);
  }
}

解决方案 »

  1.   

    用XmlDocument的方式我知道怎么操作。我现在是想dataset保存成xml的时候,怎么对指定列的内容不进行htmlencode。
      

  2.   

    还不如将数据进行Base64编码,取出来的时候再Decode。当然是自己的程序读写就好办,如果是些给别的程序读,非要写成那种格式就不知道了
      

  3.   

    这是xmlencode,不是htmlencode,写xml文件编码是必须的,不过如果你采用对应的方法读出来是可以100%还原的。例如Ds.WriteXml(Path);Ds.ReadXml(Path);