I have the following XML, and I'm trying to obtain the value where the Name attribute is ComponentVersion.
<Component .......>
<Settings>
<Setting Name="ComponentVersion" Value="12345" />
<Setting Name="Host" Value="false" />
</Settings>
<Jobs>
<Job Name="Platform" />
</Jobs>
</Component>
I read the XML file like this:
$fullPathXML = "$env:PackagesPath\Platform\Components\SystemPlatform.Comp.xml"
[xml]$xmlSystemPlatform = Get-Content $fullPathXML
and then tried the following:
$xmlSystemPlatform.selectNodes('//Settings/Setting') | select NameSelect-Xml '//Settings/Setting[contains(@Name, "ComponentVersion")]' $xmlSystemPlatform |%{$_.Node.Value}$xmlSystemPlatform.Settings.Setting[0].Name$xmlSystemPlatform.Settings.Setting[0].Value