我在.net程序中有如下代码
Session["filedetail"]="<paragraph>"+this.txtfiledetail.Text.ToString().Replace("\n","</paragraph><paragraph>")+"</paragaph>";
txtfiledetail.Text里面存着N段文字,我想通过这种方法存到xml里面去,再通过http://community.csdn.net/Expert/topic/4050/4050257.xml?temp=.9721949
这个帖子里面的内容显示。
可是存入xml里面的内容不是我想要的 出来的都是这样的: <paragraph>
怎么才能存入<>,而不是<呢
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("<哈哈哈>");
//Add the new node to the document.
XmlElement root = doc.DocumentElement;
root.AppendChild(CData);
doc.Save(@"xx.xml");