How can I remove whitespace on every instance of a particular node which I specify in C#? For example let's say that I have the following XML document:
<XML_Doc>
<Record_1>
<Name>Bob</Name>
<ID_Number>12345</ID_Number>
<Sample>
</Sample>
</Record_1>
<Record_2>
<Name>John</Name>
<ID_Number>54321</ID_Number>
<Sample>
</Sample>
</Record_2>
</XML_Doc>
What I would like is to take every instance of the <Sample>
tag and change the formatting so it looks like this:
<XML_Doc>
<Record_1>
<Name>Bob</Name>
<ID_Number>12345</ID_Number>
<Sample></Sample>
</Record_1>
<Record_2>
<Name>John</Name>
<ID_Number>54321</ID_Number>
<Sample></Sample>
</Record_2>
</XML_Doc>
EDIT:
The other application which makes use of the XML file was not written by me and I cannot modify the structure of the XML document itself. I am writing a utility which parses the XML file and replaces each instance of the node I specify. The example where the <Sample></Sample>
tag is on the same line is how the document is originally formatted and how I need it to be for the other application to be able to read it correctly.