【发布时间】:2014-08-22 15:58:23
【问题描述】:
我正在尝试搜索属性的值 (xxxx01) 并返回节点 (0x100540)。这是我的xml:
<model-response-list error="EndOfResults" throttle="86" total-models="86" xmlns="http://www.ca.com/spectrum/restful/schema/response">
<model-responses>
<model mh="0x100540">
<attribute id="0x1006e">xxxx01</attribute>
</model>
<model mh="0x100c80">
<attribute id="0x1006e">xxx02</attribute>
</model>
</model-responses>
</model-response-list>
我在下面的代码中有一个 var 中的 xml:
#Get restful req
$client->setHost('http://wltsvpnms02.aigfpc.com:8080');
$client->GET('/spectrum/restful/devices?attr=0x1006e', $headers) || die "$!";
my $parser = XML::LibXML->new();
my $xmldoc = XML::LibXML->load_xml( string => $client->responseContent() )|| die "$!";
我已经尝试了每一个 xpath 搜索,我可以找到一些文档(也许我只是无法理解它),但无法提出解决方案。
感谢您的帮助。
【问题讨论】:
标签: xml perl xpath xml-libxml