title: How to Insert a New Node Using LINQ to XML when only xml data is available?
body: <p>I have an xml file with the below structure:</p>
  
  <pre><code>&lt;connections&gt;
    &lt;connection&gt;   
      &lt;serverName&gt;serverName1&lt;/serverName&gt;
      &lt;dbName&gt;dbName1&lt;/dbName&gt;   
    &lt;/connection&gt;
  &lt;/connections&gt;
  </code></pre>
  
  <p>I have a new connection as text data as shown below:</p>
  
  <pre><code>var xml="&lt;connection&gt;&lt;serverName&gt;serverName2&lt;/serverName&gt;&lt;dbName&gt;dbName2&lt;/dbName&gt;&lt;/connection&gt;";
  
  var xDocument = XDocument.Load(HttpContext.Current.Server.MapPath(this.XmlDataFilePath));
  </code></pre>
  
  <p>How could I insert this new node to my document?</p>
  
  <p>I tried this but it failed:</p>
  
  <pre><code> xDocument.Root.AddAfterSelf(xml);
  
   xDocument.Save(HttpContext.Current.Server.MapPath(this.XmlDataFilePath));
  </code></pre>
  
  <p>Thanks,</p>