Iterating over nodes using XML::LibXML

前端 未结 1 574
渐次进展
渐次进展 2021-01-14 03:54

I am using XML::LibXML (Ver: 1.70).

My xml input file looks like this:




        
相关标签:
1条回答
  • 2021-01-14 04:39

    There's only one Equipments node, hence you only get one $camelid to scan. To remedy, you might change things slightly, say, to iterate over Equipment/ECIDs:

    foreach my $camelid ( $root->findnodes('Equipments/ECID') ) {
        my $name =  $camelid->findvalue('@logicalName');
        my $id =  $camelid->findvalue('@id');
        ...
    }
    
    0 讨论(0)
提交回复
热议问题