Good morning!
I am dealing with a problem right now where in I need to be able to remove an XML node based on a condition (i.e the value inside the XML tag is 0).
The steps I’ve tried so far is:
1.) Read text file → xml document of interest
2.) Deserialize text file → converts string to xdocument variable
3.) for each item in xdoc.Root.Descendants.Elements():
3.a) write line: item
3.b) write line: “/////////” (to separate items)
3.b) if item.tostring() = 0, remove node
This doesn’t seem to work.
Could anyone give me any insight into a quicker or more efficient way to do this? I have never worked with XML or Xdocuments before and would appreciate it.