日期:2014-05-18 浏览次数:20482 次
<?xml version="1.0" encoding="gb2312"?> <viewer interval="4000" isRandom="1"> <item title="yahooo" img="images/02.jpg" url="http://www.codepub.com/" target="_blank" /> <item title="pata" img="images/03.jpg" url="http://www.codepub.com/" target="_blank" /> <item title="music" img="images/04.jpg" url="http://www.codepub.com/" target="_blank" /> <item title="togetoge" img="images/05.jpg" url="http://www.codepub.com/" target="_blank" /> <item title="炳超" img="images/bing.jpg" url="html://www.bingchao.com" target="_blank" /> </viewer>
xmlDoc = new XmlDocument(); xmlDoc.Load(Server.MapPath("viewerData.xml")); XmlNodeList xnl = xmlDoc.SelectSingleNode("viewer").ChildNodes; foreach (XmlNode xn in xnl) { XmlElement xe = (XmlElement)xn; if ( xe.GetAttribute("title")== “炳超”) { xe.RemoveChild(xn);//删除该节点的全部内容 break; } } xmlDoc.Save(Server.MapPath("viewerData.xml"));//保存