سؤال

So according to the docs I should be able to do:

$ns = @{ns=$curNode.NamespaceURI}
$node = $curNode.SelectSingleNode('ns:tagName', $ns)
$node.value = '2'

to get the tagName node under the current curNode. But I get:

Cannot find an overload for "SelectSingleNode" and the argument count: "2".

So how do I go about getting to my child node to change its value?

If I just try

$node = $curNode.SelectSingleNode('tagName')

Then the $node is $null.

هل كانت مفيدة؟

المحلول

To change the value of an XmlElement node:

$curNode.'#text' = 2
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top