日期:2014-05-17 浏览次数:21045 次
private string xmlPath=Application.StartupPath.Replace("bin\\Debug","") + "InstallFiles\\BookMarks.xml";
private XmlDocument _XmlDoc;
public XmlDocument XmlDoc
{
get
{
_XmlDoc = new XmlDocument();
_XmlDoc.Load(xmlPath);
return _XmlDoc;
}
}
public bool DelBookName(string nodeName)
{
XmlNodeList xmlNodes = XmlDoc.SelectSingleNode("BookMarks").ChildNodes;
foreach (XmlNode node in xmlNodes)
{
XmlElement xmlEle = (XmlElement)node;
if (xmlEle.GetAttribute("Name").Equals(nodeName))
{
node.ParentNode.RemoveChild(node);
//xmlEle.ParentNode.RemoveChild(node);
XmlDoc.Save(xmlPath);
return true;
}
}
return false;
}