title: Iterating over nodes using XML::LibXML
body: <p>I am using XML::LibXML (Ver: 1.70).</p>
  
  <p>My xml input file looks like this:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;Equipment xmlns:xsd="http://www.w3.org/2001/XMLSchema"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
    &lt;Equipments&gt;
      &lt;ECID logicalName="SysNameAlpha" id="0"/&gt;
      &lt;ECID logicalName="SysNameBeta" id="1"/&gt;
    &lt;/Equipments&gt;
  &lt;/Equipment&gt;
  </code></pre>
  
  <p>and my Perl script:</p>
  
  <pre><code>my $file = 'data.xml';
  my $parser = XML::LibXML-&gt;new();
  my $tree = $parser-&gt;parse_file($file);
  my $root = $tree-&gt;getDocumentElement;
  
  foreach my $camelid ($root-&gt;findnodes('Equipments')) {
      my $name =  $camelid-&gt;findvalue('ECID/@logicalName');
      my $id =  $camelid-&gt;findvalue('ECID/@id');
      print $name;
      print " = ";
      print $id;
      print ";\n";
  }
  </code></pre>
  
  <p>The output I get is:</p>
  
  <pre><code>SysNameAlphaSysNameBeta = 01;
  </code></pre>
  
  <p>But I want output like this:</p>
  
  <pre><code>SysNameAlpha = 0;    
  SysNameBeta = 1;
  </code></pre>
  
  <p>How can I achieve this?</p>