Simplest way To Remove a Node From XML on a Condition on its attribute

Puneet20884
Posted by Puneet20884 under C# category on | Views : 1793
XmlNode rootNode = xmlDoc.SelectSingleNode("root");
XmlNode delNode = xmlDoc.SelectSingleNode("root/leaf[@id=\"" + lstLeaves.SelectedValue + "\"]");
rootNode.RemoveChild(delNode);

Comments or Responses

Login to post response