vendredi 31 juillet 2015

How do I select from xml document multiple times with powershell

I am trying to select multiple groups of elements from an XML document, the sample below shows the type of structure I'm using. Why does the powershell code below only output the 2 names, but not the 2 stores.

[xml]$xml = @'
<root>
  <node>
    <store>HEB</store>
    <name>Fred</name>
  </node>
  <node>
    <store>Fred Meyer</store>
    <name>Barney</name>
  </node>
</root>
'@;

$xml.root.node | select  name -unique

$xml.message.node | select store -unique

Output

.\test.ps1

name
----
Fred
Barney

Aucun commentaire:

Enregistrer un commentaire