我有以下xml
<?xml version="1.0" encoding="utf-8"?>
<Response>
<Function Name="GetSomethingById">
<something idSome="1" Code="1" Description="TEST01" LEFT="0" RIGHT="750" />
</Function>
</Response>
我想要节点的属性<something>
作为哈希。我尝试如下
my $xpc = XML::LibXML::XPathContext->new(
XML::LibXML->new()->parse_string($xml) # $xml is containing the above xml
);
my @nodes = $xpc->findnodes('/Response/Function/something');
我期待有类似的东西$nodes[0]->getAttributes
,有什么帮助吗?