Here is my sample XML,
<root> <Countries> <Country Name="USA"> <MyFilters> <Filter>aaa</Filter> <Filter>bbb</Filter> <Filter>ccc</Filter> <Filter>ddd</Filter> </MyFilters> </Country> </Countries> </root> I am trying to loop through each "Filter" tags and use its value - "aaa","bbb",.. for my subsequent process in powershell. I am using Xpath to access these values. Here is my script,
$Country = $config_xml.selectnodes('/root/Countries/Country[@Name = "USA"]/MyFilters') foreach ($Filter in $Country){ Write-Host $Filter.InnerText } But this is outputting me all the Filter Values in one single line like this aaa bbb ccc ddd . How do I use my Xpath to fetch one Filter at a time?
Thanks.
No comments:
Post a Comment