title: PowerShell set_InnerXML on node
body: <p>I'm working with PowerShell to manipulate some XML and I've managed to get set_InnerXML("contents") working when creating Elements that are being added to the DOM but I've having difficulty adding a string of nodes to a node in the DOM.</p>
  
  <p>Working example when creating element</p>
  
  <pre><code>$xml = New-Object XML
  $xml.Load(".\file.xml")
  $newnode= $xml.CreateElement("newelament")
  $newnode.set_InnerXML("&lt;stringnode&gt;content&lt;/stringnode&gt;")
  $root = $xml.get_DocumentElement()
  $result = $root.InsertAfter($newnode, $root.get_FirstChild())
  $xml.Save(".\file.xml")
  </code></pre>
  
  <p>Not working example with existing nodes</p>
  
  <pre><code>$xml = New-Object XML
  $xml.Load(".\file.xml")
  $xml.node1.node2.set_InnerXML("&lt;stringnode&gt;content&lt;/stringnode&gt;")
  $xml.Save(".\file.xml")
  </code></pre>
  
  <p>Any sugestions on how to do this would be appreciated.</p>