I need to pull out all of the "NodeGroup" elements out of an XML file:
<Database>
<Get>
<Data>
<NodeGroups>
<NodeGroup>
<AssociateNode ConnID="6748763_2" />
<AssociateNode ConnID="6748763_1" />
<Data DataType="Capacity">2</Data>
<Name>Alpha</Name>
</NodeGroup>
<NodeGroup>
<AssociateNode ConnID="6748763_23" />
<AssociateNode ConnID="6748763_7" />
<Data DataType="Capacity">2</Data>
<Name>Charlie</Name>
</NodeGroup>
<NodeGroup>
<AssociateNode ConnID="6748763_98" />
<AssociateNode ConnID="6748763_12" />
<Data DataType="Capacity">2</Data>
<Name>Papa</Name>
</NodeGroup>
<NodeGroup>
<AssociateNode ConnID="6748763_8" />
<AssociateNode ConnID="6748763_45" />
<Data DataType="Capacity">2</Data>
<Name>Yankee</Name>
</NodeGroup>
</NodeGroups>
<System>
...
</System>
</Data>
</Get>
</Database>
If I could use python and BeautifulSoup, I would parse the xml and call something like:
node_group_array = soup.findAll("nodegroups")
But I am using Perl and Perl's XML modules, so I used XML::Simple's XMLIn, recursively walking through each hash key, checking if the value was a hash, checking if it was the "NodeGroup" hash, etc.
I would think that there's something like soup.findAll() in one of Perl's XML modules, but I can't find it. How do I do "soup.findAll('nodegroups')" in Perl?