.net 操作xml: 找到节点并删除该节点
private void DelImage(string pID)
{
//update xml
System.Xml.XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(fileUrl);
XmlNode node = xmlDoc.SelectSingleNode("/album/folder/photoes/photo[guid='" + pID + "']");
node.ParentNode.RemoveChild(node); //good method!!!
xmlDoc.Save(fileUrl);
//del the file
}
{
//update xml
System.Xml.XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(fileUrl);
XmlNode node = xmlDoc.SelectSingleNode("/album/folder/photoes/photo[guid='" + pID + "']");
node.ParentNode.RemoveChild(node); //good method!!!
xmlDoc.Save(fileUrl);
//del the file
}