title: xml same tag name on different levels
body: <p>I am trying to parse an xml document using Perl <strong>XML::LibXML::reader</strong> module .
  The module works well and i was able to parse most of the document ,but there are sections on the xml which could have multiple elements with the same name on different levels and i didn't know how to apporach and deal with such elements ,</p>
  
  <p>what I am trying to do is to convert the below strcutre to conveinent  perl data structure i tried to use <strong>XML::Simple</strong> and <strong>XML::Twig</strong> smplify subroutine (see below )in addition to XML::LibXML  but parsing this section with them is very slow(x20 slower than parsing the document without them), </p>
  
  <pre><code> my @conf= eval{($copy-&gt;findnodes('criteria'))};
   my $t= XML::Twig-&gt;new();
    my $hash=$t-&gt;parse($_-&gt;toString)-&gt;simplify(forcearray =&gt;1  ]);
    $t-&gt;purge();
  </code></pre>
  
  <p>could someone suggest how can i parse the below section to convient perl data structre with XML::LibXML::reader in faster manner.
  any help with be appreciated </p>
  
  <pre><code> example of such file :
  
   &lt;criteria operator="OR"&gt;
  
      &lt;criteria operator="AND"&gt;  -&gt; nested element
      &lt;criterion test_ref="oval:org.mitre.oval:tst:123" comment="Windows XP is installed"/&gt;
      &lt;criterion test_ref="oval:org.mitre.oval:tst:234" comment="file foo.txt exists"/&gt;
      &lt;criteria operator="OR"&gt; -&gt; nested element
      &lt;criterion test_ref="oval:org.mitre.oval:tst:127" comment="file x.txt exists"/&gt;
      &lt;criterion test_ref="oval:org.mitre.oval:tst:127" comment="file y.txt exists"/&gt;
      &lt;/criteria&gt; 
       &lt;/criteria&gt; 
      &lt;criteria operator="AND" negate="true"&gt; -&gt;nested element
      &lt;criterion test_ref="oval:org.mitre.oval:tst:345" comment="Windows 2003 is installed"/&gt;
      &lt;criterion test_ref="oval:org.mitre.oval:tst:456" comment="file fred.txt has a version less than 2"/&gt;
      &lt;criterion test_ref="oval:org.mitre.oval:tst:567" negate="true" comment=patch is installed"/&gt;
      &lt;/criteria&gt;
      &lt;criterion test_ref="oval:org.mitre.oval:tst:345" comment="Windows 2003 is installed"/&gt;
   &lt;/criteria&gt;
  </code></pre>