I am tring to parse the following file:
<?xml version="1.0" encoding="UTF-8" ?>
<printDrivers>
<printDriver id="XE8550">
<inf>x28550p.inf</inf>
<driverPath>\drivers\XEROX\8550\8550_Driver</driverPath>
<printerPaths>
<printerPath>\\print-man\man-25</printerPath>
</printerPaths>
</printDriver>
<printDriver id="HP4050TN">
<inf>hpbf002i.inf</inf>
<driverPath>\drivers\HP\LaserJet\LaserJet_4050_PCL6</driverPath>
<printerPaths>
<printerPath>\\print-man\man-8</printerPath>
<printerPath>\\print-man\man-14</printerPath>
</printerPaths>
</printDriver>
</printDrivers>
with the following powershell script:
$nodelist = $xd.selectnodes("/printDrivers/printDriver") # XPath is case sensitive
foreach ($printerDriverNode in $nodelist) {
$XMLid = $printerDriverNode.getAttribute("id")
$XMLinf = $printerDriverNode.selectSingleNode("inf").get_innerXml()
$XMLdriverPath = $printerDriverNode.selectSingleNode("driverPath").get_innerXml()
$printerPathNodeList = $printerDriverNode.selectNodes("printerPaths/printerPath")
foreach ($printerPathNode in $printerPathNodeList) {
$XMLprinterPath = $printerPathNode.selectSingleNode("printerPath").get_innerXml()
}
}
It all works fine, except for the "nested" node. When I run the script it only gets the first . i.e. it won't get \print-man\man-14, only \print-man\man-8.
How can I get it to bring back all of the nodes?
Thanks,
Ben