clone 187583 -1
reassign -1 libxml-xpathengine-perl 0.08-1
notforwarded -1
submitter -1 !
thanks
On Sun, Dec 30, 2007 at 09:55:26PM +0200, Niko Tyni wrote:
> On Fri, Apr 04, 2003 at 02:10:25PM +0200, Stephane Bortzmeyer wrote:
> > Package: libxml-xpath-perl
> > Version: 1.13-3
> > Severity: normal
> >
> >
> > % xpath -e 'text/para/node()[preceding-sibling::important and
> > position()=last()]' example.xml
> > Can't call method "size" on an undefined value at
> > /usr/share/perl5/XML/XPath/Parser.pm line 107.
> this happens because evaluating the 'preceding-sibling::important' condition
> loses the position/context information. I'm attaching a failing testcase
> and a patch that fixes the issue.
The same bug is also present in libxml-xpathengine-perl (a fork of the
same codebase), as shown by the attached test script.
Cloning accordingly. This should be reported upstream too.
I assume the same patch applies more or less unchanged, but haven't
checked yet.
Cheers,
--
Niko Tyni [EMAIL PROTECTED]
#!/usr/bin/perl -w
use strict;
use XML::DOM::XPath;
my $expr = "text/para/node()[preceding-sibling::important and
position()=last()]";
#my $expr = "text/para/node()[position()=last() and
preceding-sibling::important]";
my $parser = XML::DOM::Parser->new;
my $doc = $parser->parse(*DATA);
my @nodes = $doc->findnodes($expr);
for (@nodes) {
print $_->getNodeValue;
}
__DATA__
<?xml version="1.0" encoding="us-ascii" standalone="no"?>
<!DOCTYPE text SYSTEM "example.dtd"[
]>
<text>
<para>I start the text here, I break
the line and I go on, I <blink>twinkle</blink> and then I go on
again.
This is not a new paragraph.</para><para>This is a
<important>new</important> paragraph and
<blink>this word</blink> has a preceding sibling.</para>
</text>