Ok, i have an xml document like..
<navigation>
<page id="1"></page>
<page id="2"></page>
<page id="3"></page>
<page id="4"></page>
<page id="5"></page>
</navigation>
and i need to delete nodes. Im passing the ID back but just cant seem to find the correct method to delete it.
Please help...
-
-
If your using DOM then the below will work. Don't know if its the best way.
XmlDocument d = new XmlDocument();d.Load("MyFileName.Xml");
XmlNode t = d.SelectSingleNode("/navigation/page[@id='1']");
t.ParentNode.RemoveChild(t);
d.Save();
-
Thanks dude..
I had the same code, but for the life of me couldnt work out why it wasnt working... i forgot the Save().. Doh!!
Thanks again -
It's always the simplest thing that is missing
I was about to post the same. But you were faster.
Thread Closed
This thread is kinda stale and has been closed but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.