Reputation: 1208
I want to verify that an xml file has data past any first tier node.
My .xml file looks like:
<?xml version="1.0" encoding="utf-8"?>
<[NodeName] xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<[NodeNameHere] "information here" />
</Node1>
The [NodeNameHere]
and [NodeName]
changes between files so I can't use that to test to see if there are child nodes.
So far I've tried using:
$xmlFile.LastChild.HasChildNodes
$xmlFile.FirstChild.HasChildNodes
In the above example the LastChild
returns true while the FirstChild
returns false. This would work, however there may be another node (not first or last) that contains data.
Upvotes: 0
Views: 120