开发者

XML::LibXML - detect if two Elements are the same?

开发者 https://www.devze.com 2023-03-31 04:40 出处:网络
I\'m working with XML::LibXML in Perl. Say I have two $element references gotten by different (opaque) XPath queries.

I'm working with XML::LibXML in Perl.

Say I have two $element references gotten by different (opaque) XPath queries.

(How) can I determine, if the two $element (Node) refs are the same element in the document tree?

C开发者_运维问答omparing $el1 == $el2doesn't always work as far as I could tell.


It's in the XML::LibXML::Node documentation:


isSameNode

$bool = $node->isSameNode( $other_node );

returns TRUE (1) if the given nodes refer to the same node structure, otherwise FALSE (0) is returned.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号