0
我想用一堆不同的XML文件构建一个大型的XML数据结构,我需要在不同情况下追加和替换节点。我的理解是ReplaceChild方法就像AppendChild方法,但它会覆盖有问题的节点。因此,考虑到这个工程追加ReplaceChild vs AppendChild
$parentNode.AppendChild($result.xml.ImportNode($temp.xml.SelectSingleNode("//Product[@id='$($node.ID)']/$($firmNode.Name)"), $true)) > $null
我尝试这样做,以取代
$parentNode.ReplaceChild($result.xml.ImportNode($temp.xml.SelectSingleNode("//Product[@id='$($node.ID)']/$($firmNode.Name)"), $true)) > $null
而且我得到的replaceChild“为无法找到过载‘’我是被迫使用PS2.0,所以我想那里只是没有可用的replaceChild?我可没有问题removeChild之,然后使用appendChild,但如果有可能只是替换将是首选的节点。
啊,这很有道理。你必须交换对象的对象。 – Gordon