How to remove multiple childnodes from an XML Node specified by XPath:
public static XmlDocument RemoveNodes(string xPath,XmlDocument xmlRequest){
XmlNodeList xmlNodeList = xmlRequest.SelectNodes(xPath);
IEnumerator en = xmlNodeList.GetEnumerator();
while (en.MoveNext())
{
XmlNode xmlNode = (XmlNode)en.Current;
XmlNode xmlRoot = xmlNode.ParentNode;
xmlRoot.RemoveChild(xmlNode);
}
return xmlRequest;
}
Tags:
C#