日期:2014-05-18  浏览次数:20849 次

kindeditor用XML存储数据,怎样能避免把标点看作特殊字符的错误
后台代码
public partial class Admin_information_informations : System.Web.UI.Page
{
  protected static string informations_id = "1";
  protected void Page_Load(object sender, EventArgs e)
  {
  if (!IsPostBack)
  {
  this.onloadXml(informations_id);
  }
  }
   
  protected void LinkButton1_Click(object sender, EventArgs e)
  {
  this.onloadXml("1");
  informations_id = "1";
  }
  protected void LinkButton2_Click(object sender, EventArgs e)
  {
  this.onloadXml("2");
  informations_id = "2";
  }
  protected void LinkButton3_Click(object sender, EventArgs e)
  {
  this.onloadXml("3");
  informations_id = "3";
  }
  protected void LinkButton4_Click(object sender, EventArgs e)
  {
  this.onloadXml("4");
  informations_id = "4";
  }
  protected void LinkButton5_Click(object sender, EventArgs e)
  {
  this.onloadXml("5");
  informations_id = "5";
  }

  protected void Btn_save_Click(object sender, EventArgs e)
  {
  string url = Server.MapPath("information.xml");
  XmlDocument xmlDoc = new XmlDocument();
  xmlDoc.Load(url);//加载XML文档
  XmlNode root = xmlDoc.SelectSingleNode("informations");
  XmlNodeList xnl = root.ChildNodes;//获取informations下面所有子节点
  for (int i = 0; i < xnl.Count; i++)
  {
  XmlNodeList xnl11 = xnl.Item(i).SelectNodes("id");//查找informations_id下面节点结合
  XmlElement xe = (XmlElement)xnl11.Item(0);//informations_id节点下面的元素
  if (xe.InnerText == informations_id)//获取节点以及所有子集的串联值
  {
  xe.ParentNode.ChildNodes.Item(1).InnerText = this.TextBox1.Text;
  xe.ParentNode.ChildNodes.Item(2).InnerText = this.content1.Value;
  }
  }
  xmlDoc.Save(url);//保存XML文档
  NormalMethod.showTip("修改成功", "informations.aspx?id=" + informations_id);
  }
  protected void onloadXml(string id)
  {
  string url = Server.MapPath("information.xml");
  XmlDocument xmlDoc = new XmlDocument();
  xmlDoc.Load(url);//加载XML文档
  XmlNode root = xmlDoc.SelectSingleNode("informations/information[id='" + id + "']");
  if (root != null)
  {
  this.TextBox1.Text = root.ChildNodes[1].InnerText;
  this.content1.Value = root.ChildNodes[2].InnerText;
  }
  }
}





前台代码
<head runat="server">
  <title>无标题页</title>
  <script type="text/javascript" src="../Resourse/Script/Splitter.js"></script>
  <script type="text/javascript" src="../Resourse/Script/check.js"></script>

  <script src="../Resourse/datepicker/WdatePicker.js" type="text/javascript"></script>


  <script src="../Resourse/Script/Window.js" type="text/javascript"