I have the following bit in a Powershell script:
[xml]$xmlConfig = Get-Content "odata.xml"
$validNodes = $xmlConfig | Select-Xml -XPath '//variable' | %{$_ | ?{((($_.Node.Property.Name -eq "id") -and ($_.Node.Property.Value -eq "this-is-the-node")))}}
if ($validNodes.Count -gt 0)
{
$validNodes.development = $encryptedcredentials
}
And it's not returning valid nodes, even though the node is there.
The XML file looks like the following:
<configuration>
<variable>
<id>this-is-not-the-node</id>
<development>2</development>
<staging>0</staging>
<production>0</production>
</variable>
<variable>
<id>this-is-the-node</id>
<development>2</development>
<staging>0</staging>
<production>0</production>
</variable>
<variable>
<id>this-is-not-the-node-either</id>
<development>2</development>
<staging>0</staging>
<production>0</production>
</variable>
</configuration>
I want to select the valid node, then edit the value for development under that node.
Any ideas what I'm doing wrong?