<p>I want add the new node as parent node of the old nodes in XML using C#. for example node have the following XMl file:</p>

<pre><code>&lt;bookstore&gt;
   &lt;books&gt;
      &lt;author&gt;
      &lt;/author&gt;
   &lt;/books&gt; 
&lt;/bookstore&gt;
</code></pre>

<p>like that now I want add the new like below:</p>

<pre><code>&lt;bookstore&gt;
 &lt;newnode&gt;
   &lt;books&gt;
      &lt;author&gt;
      &lt;/author&gt;
   &lt;/books&gt; 
 &lt;/newnode&gt;
&lt;/bookstore&gt;
</code></pre>

Don't have VS here so can't confirm that this works but something like this:
```
```
XmlDocument xd = new XmlDocument();
xd.Load("oldxmlfile.xml");
XmlNode oldNode = xd["nameOfRootNode"];
xd.RemoveAll();
XmlNode newParent = xd.CreateNode("nodename");
newParent.AppendChild(oldNode);
xd.AppendChild(newParent);
xd.Save("newXmlFile.xml");
```
```