Subject: | xpath segfault |
When I try to treat a DocumentFragment as a real Document node, and use
xpath like '/whatever', I get a segfault. I'm not sure whether I should
get the expected results (would be very convenient if it worked), but I
don't think XML::LibXML should segfault.
I attached a little script that demonstrates that travelling up the tree
yourself ends correctly because the DocumentFragment has no parent node,
but trying to use an xpath expression that would need to do the same
segfaults.
Subject: | testlibxml.pl |
use XML::LibXML;
my $df = XML::LibXML::DocumentFragment->new;
my $xpc = XML::LibXML::XPathContext->new;
$xpc->registerNs('meh', 'some:namespace');
my $node = $df->addNewChild('some:namespace', 'meh:foo');
my $child = $node->addNewChild('some:namespace', 'meh:bar');
my $search = $node->addNewChild('some:namespace', 'meh:baz');
my $test = $search;
while ($test = $test->parentNode) {
warn $test->nodeName;
}
my @result;
foreach my $xpath ('../meh:bar', '//meh:foo/meh:bar') {
@result = $xpc->findnodes($xpath, $search);
warn map {$_->toString} @result;
}