title: Perl using XML Path Context to extract out data
body: <p>I have the following xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;Response&gt;
     &lt;Function Name="GetSomethingById"&gt;
        &lt;something idSome="1" Code="1" Description="TEST01" LEFT="0" RIGHT="750" /&gt;
     &lt;/Function&gt;
  &lt;/Response&gt;
  </code></pre>
  
  <p>and I want the attributes of <code>&lt;something&gt;</code> node as a hash. Im trying like below</p>
  
  <pre><code>my $xpc = XML::LibXML::XPathContext-&gt;new(
      XML::LibXML-&gt;new()-&gt;parse_string($xml)   # $xml is containing the above xml
  );
  my @nodes = $xpc-&gt;findnodes('/Response/Function/something');
  </code></pre>
  
  <p>Im expecting to have something like <code>$nodes[0]-&gt;getAttributes</code>, any help?</p>