use CDataSection
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("<html>fsdfsfsd</html><br>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);
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("<html>fsdfsfsd</html><br>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);
<CompInfoamtion><Byelaw>
...
...
<CreaDate>2003-12-12</CreaDate>
....
<Body><table><td>....</table></Body>
</Byelaw</CompInfoamtion>如何把<Body><CreaDate>等节点中的内容读取出来。
doc.Load("yourxml.xml");
XmlNode node = doc.SelectSingleNode("//Body/CreaDate");
if (node != null)
{
Console.WriteLine(node.InnerText);
}