I have this XML file:
<shows>
<breaking.bad />
<stranger.things />
</shows>
And i want to modify it using powershell so it will become:
<shows>
<breaking.bad />
<stranger.things />
</shows>
<movies>
</movies>
I tried this and it did not work:
$doc = [xml](get-content "c:\list.xml")
$movies = $doc.createelement("movies")
$doc.appendchild($movies)
There's an error saying: Exception calling "AppendChild" with "1" argument (s): "This document already has a 'DocumentElement' node." At line:3 char:1 + $doc.appendchild($movies)