protected void savetopic_Click(object sender, EventArgs e) { #region 保存主题修改 XmlDocumentExtender doc = new XmlDocumentExtender(); doc.Load(configPath); XmlNodeList topiclistNode = doc.SelectNodes("/Aggregationinfo/Aggregationpage/Website/Forum/Topiclist/Topic"); XmlNodeInnerTextVisitor topicvisitor = new XmlNodeInnerTextVisitor(); foreach (XmlNode topic in topiclistNode) { topicvisitor.SetNode(topic); if (topicvisitor["topicid"] == topicid.Value) { topicvisitor["topicid"] = topicid.Value; topicvisitor["title"] = tbtitle.Text; topicvisitor["poster"] = poster.Text; topicvisitor["postdatetime"] = postdatetime.Text; XmlCDataSection shortDes = doc.CreateCDataSection("shortdescription"); shortDes.InnerText = shortdescription.Text; topicvisitor.GetNode("shortdescription").RemoveAll(); topicvisitor.GetNode("shortdescription").AppendChild(shortDes); break; } } doc.Save(configPath); Response.Redirect("aggregation_editforumaggset.aspx"); #endregion }
private void ModifyNode(XmlDocumentExtender doc, string topicPath) { XmlNodeList topiclistNode = doc.SelectNodes(topicPath); XmlNodeInnerTextVisitor topicvisitor = new XmlNodeInnerTextVisitor(); foreach (XmlNode topic in topiclistNode) { topicvisitor.SetNode(topic); if (topicvisitor["topicid"] == topicid.Value) { topicvisitor["topicid"] = topicid.Value; topicvisitor["title"] = title.Text; topicvisitor["poster"] = poster.Text; topicvisitor["postdatetime"] = postdatetime.Text; XmlCDataSection shortDes = doc.CreateCDataSection("shortdescription"); shortDes.InnerText = shortdescription.Text; topicvisitor.GetNode("shortdescription").RemoveAll(); topicvisitor.GetNode("shortdescription").AppendChild(shortDes); break; } } }
private void ModifyNode(XmlDocumentExtender doc, string topicPath) { XmlNodeList xmlNodeList = doc.SelectNodes(topicPath); XmlNodeInnerTextVisitor xmlNodeInnerTextVisitor = new XmlNodeInnerTextVisitor(); foreach (XmlNode node in xmlNodeList) { xmlNodeInnerTextVisitor.SetNode(node); if (xmlNodeInnerTextVisitor["topicid"] == this.topicid.Value) { xmlNodeInnerTextVisitor["topicid"] = this.topicid.Value; xmlNodeInnerTextVisitor["title"] = this.title.Text; xmlNodeInnerTextVisitor["poster"] = this.poster.Text; xmlNodeInnerTextVisitor["postdatetime"] = this.postdatetime.Text; XmlCDataSection xmlCDataSection = doc.CreateCDataSection("shortdescription"); xmlCDataSection.InnerText = this.shortdescription.Text; xmlNodeInnerTextVisitor.GetNode("shortdescription").RemoveAll(); xmlNodeInnerTextVisitor.GetNode("shortdescription").AppendChild(xmlCDataSection); break; } } }