Posted By: MattShepherd | Jun 20th, 2005 @ 2:57 AM
page 1 of 1
Comments: 3 | Views: 14860
MattShepherd
MattShepherd
Ave It
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();

littleguru
littleguru
<3 Seattle
It's always the simplest thing that is missing Smiley I was about to post the same. But you were faster.
page 1 of 1
Comments: 3 | Views: 14860
Microsoft Communities