07-21-2023, 07:42 PM
I am trying to use powershell and XPath to select the name attribute shown in the below xml example.
$xml_peoples= $file.SelectNodes("//people")
foreach ($person in $xml_peoples){
echo $person.attributes
#echo $person.attributes.name
}
Above is the code im running to try and get the name, but it doesn't seem to work. Any suggestions?
<peoples>
<person name='James'>
<device>
<id>james1</id>
<ip>192.192.192.192</ip>
</device>
</person>
</peoples>
Thanks in advance!
$xml_peoples= $file.SelectNodes("//people")
foreach ($person in $xml_peoples){
echo $person.attributes
#echo $person.attributes.name
}
Above is the code im running to try and get the name, but it doesn't seem to work. Any suggestions?
<peoples>
<person name='James'>
<device>
<id>james1</id>
<ip>192.192.192.192</ip>
</device>
</person>
</peoples>
Thanks in advance!