I am using one xml document in my code to collect a response from different calls that I make inside of my c# code. The program runs in a loop and loads the same xml document with different xml content and stores it in a database.However, on some calls, there will be no output generated and in that case I will need to simply clear out the contents of my xml. What would be the way to do it?
the break down of what i am trying to achieve here:
XmlDocument output = new XmlDocument();
On the first run i will get something like that:
after storing it in the database, I want to clear out the contents of it.
Thanks for your help!
As @Fabio said you could just sent it to a new instance of an XmlDocument. Another solution would be to set the InnerText property to an empty string.
output.InnerText = string.Empty;
This would effectively clear out the document.