title: Recreate the same XML document if the original XML document is deleted
body: <p>I developed a sample application to create an XML document, and I created and saved the XML documented. The application is still running but I delete that XML document and I am now trying to create a new XML using the same application.  I got an error of</p>
  <blockquote>
  <p>this document already has 'DocumentElement' node</p>
  </blockquote>
  <pre class="lang-cs prettyprint-override"><code>if (File.Exists(AppPath) == false)
  {
      root = doc.CreateElement(&quot;LicenseDetails&quot;);
      
      rootnode = doc.CreateElement(&quot;License&quot;);
      Login = doc.CreateElement(&quot;Login_Name&quot;);
      Login.InnerText = &quot;KSC&quot;;
      rootnode.AppendChild(Login);
      root.AppendChild(rootnode);
      doc.AppendChild(root);
      doc.Save(AppPath);
  }
  </code></pre>
  <p>I can easily append the node in existing XML document but what I want to do is:  if my XML got deleted, application has to create a new XML with same tags.</p>