-1

I have repeated xml fragment like this below in a larger document. How to remove all occurrences of well, total and fee using XmlDocument?

<res>
  <pay>
    <well/>
    <total/>
    <fee/>
    <tit>
        <qr>asdf</qr>
        <id>
            <num/>
        </id>
    </tit>
  </pay>
</res>
v.g.
  • 1,076
  • 5
  • 19
  • 38

1 Answers1

0

Load the xml into an XDocument (https://msdn.microsoft.com/en-us/library/system.xml.linq.xdocument(v=vs.110).aspx) and then use linq to find and remove the nodes in question.

Then its just a duplicate of XDocument deleting a node

If you really want to use the XMLDocument instead of XDocument class then this is a dup of Removing nodes from an XmlDocument

Community
  • 1
  • 1
Paul Swetz
  • 2,234
  • 1
  • 11
  • 28