Import node from one XML to another on PowerShell

前端 未结 2 1141
傲寒
傲寒 2021-01-25 04:45

I need to copy node with name \"ProjectOptions\" from default.xml to original.xml without modifying anything else:

Original.xml



        
2条回答
  •  情话喂你
    2021-01-25 05:01

    Found a simple way:

    $xmlPO = $xml.SelectNodes("//KEY[@ObjectName='ProjectOptions']")
    $xmldPO = $xmld.SelectNodes("//KEY[@ObjectName='ProjectOptions']")
    $xmlPO.set_InnerXML($xmldPO.innerXML)
    $xml.Save($dpath)​
    

提交回复
热议问题