title: Adding data to an existing xml file
body: <p>I am using the follwing syntax to add data to already existing xml file in the following way:</p>
  
  <pre><code>XmlTextReader Reader = new XmlTextReader("ServerPaths.xml");
          DataSet dsNewList = new DataSet();
          dsNewList.ReadXml(Reader);
          Reader.Close();
          DataTable dt = dsNewList.Tables[0];
          dt.Rows.Add(txtNewServerPath.Text);
          dt.WriteXml("ServerPaths.xml",false);
  </code></pre>
  
  <p>But, i was getting error at last line as:</p>
  
  <pre><code>System.IO.IOException was unhandled
            Message=The process cannot access the file 'C:\Documents and Settings\590000\my documents\visual studio 2010\Projects\EasyDeployer\EasyDeployer\bin\Debug\ServerPaths.xml' because it is being used by another process
  </code></pre>
  
  <p>Please help in solving this error. or is there any other way to do this?</p>
  
  <p>My xml file looks like this:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;ServerList&gt;
  &lt;ServerPath&gt;C:\\Avinash\\Dev1&lt;/ServerPath&gt;
  &lt;ServerPath&gt;C:\\Avinash\\Dev1&lt;/ServerPath&gt;
  &lt;/ServerList&gt;
  </code></pre>
  
  <p>I just wanted to add new serverpath..</p>