As i said in the Title: I'm trying to delete a Spezific XML node(in c#).
so i researched and found this:
XmlDocument xmlDoc = new XmlDocument();
XmlNode nodeToDelete = xmlDoc.SelectSingleNode("/root/XMLFileName[@ID="+nodeId+"]");
if (nodeToDelete != null)
{
nodeToDelete.ParentNode.RemoveChild(nodeToDelete);
}
xmlDoc.Save("XMLFileName.xml")
by Johnny
and i understand here that he's tergeting a speziffic node ( in this case "[@ID ="+nodeId+)
Ok, my question is can i do the same just in the opposite way, by that i mean if its not nodeId then delete it (just like the "!="-Operator in C#).
If i understood something wrong pls type it in the commends :) constructive criticism is welcome :)
No comments:
Post a Comment