The following code should help you out, just done in notepad so best to check it
Main Topics
Browse All TopicsThis is a minor problem, but if you have input I would appreciate it.
I want to remove all the nodes anywhere in an XML document that have element name No_export_rule.
The code below almost does this. It removes all the attributes and so forth but leaves behind an empty element. I would like to remove the elements rather than just empty them.
Thanks for your input.
//AFTER THE CODE RUNS
<No_Export_Rule>
</No_Export_Rule>
<No_Export_Rule>
</No_Export_Rule>
<No_Export_Rule>
</No_Export_Rule>
//BEFORE THE CODE RUNS
<No_Export_Rule Lbl='Locality' Table='Report' Field='ORI_NO' Pl='0' Ctl='IDRTC_LOCALITY'><
Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: csharppPosted on 2009-06-05 at 06:58:00ID: 24556444
node.RemoveAll() removes only the attributes and child nodes. node) instead of node.RemoveAll();
You have to use m_xmlDocument.RemoveChild(