string path = HttpContext.Current.Request.PhysicalApplicationPath + "xml/bcastr.xml";
string id = Request.QueryString["id"];
XmlDocument myxdoc = new XmlDocument();
myxdoc.Load(path);
XmlNode imageNode = myxdoc.ChildNodes[1];
XmlElement tempxe = null;
foreach (XmlNode tempxn in imageNode.ChildNodes)
{
if (tempxn.Attributes["id"].Value == id)
{
tempxe = (XmlElement)tempxn;
imageNode.RemoveChild(tempxe);
}
}
tempxe.SetAttribute("link", TB_Link.Text );
tempxe.SetAttribute("itemtitle", TB_Title.Text);
imageNode.PrependChild(tempxe);
myxdoc.Save(path);
asp.net修改XML
最新推荐文章于 2020-12-21 20:05:46 发布