I have the above XML and code:
XML
Code
var deleteNode = doc.SelectSingleNode("//Library/Game[id='1']");
deleteNode.ParentNode.RemoveAll();
I want to remove the following:
It should look like this after:
The code doesnt seem to be working though :(
Jay
VulpesPosted Apr 17, 2011, 5:39 PM
For LINQ to XML, I'd use:
doc.Descendants("Game").Where( e => (string)e.Attribute("id") == "1").Remove();
Jay WebsterPosted Apr 17, 2011, 6:41 PM
Thanks!