Subject: | XML::DOM::XPath restricts regular XML::XPath use |
OS: WinXP
perl -v: 5.8.4
XML-DOM-XPath-0.08
(with or without XML::XPath patch written by Mirod)
=====
I have integrated XML::DOM::XPath into existing code, part of which already uses XML::XPath. I now find that expressions that used to give correct results throw an error.
Example:
===========
use XML::DOM::XPath; # if you delete this line it'll work
use XML::XPath;
my $xml = <<EOF;
<?xml version="1.0" encoding="UTF-8"?>
<school>
<class>
<student name="joe"/>
<student/>
</class>
</school>
EOF
my $xp = XML::XPath->new($xml);
my $exp = '/school/class/student/@name';
my $nodeSet = $xp->find($exp);
print "number of nodes: ".$nodeSet->size()."\n";
==============
I get:
------
No such method cmp in XML::XPath::Node::ElementImpl at C:/Perl/site/lib/XML/DOM/XPath.pm line 28
------
But if I delete the first line I get:
--------
number of nodes: 1
--------
As expected.