Skip Menu |

This queue is for tickets about the XML-LibXML CPAN distribution.

Report information
The Basics
Id: 29650
Status: resolved
Priority: 0/
Queue: XML-LibXML

People
Owner: Nobody in particular
Requestors: ksedov [...] swsoft.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Bug in XML::LibXML (most probably in libxml2)
Date: Fri, 28 Sep 2007 08:38:23 +0400
To: <bug-XML-LibXML [...] rt.cpan.org>
From: "Konstantin Sedov" <ksedov [...] swsoft.com>
I) DESCRIPTION: XPATH search works wrong when prefixes of NameSpaces registered by application and used by XML document are intersecting. II) DETAILS: Use perl script (1.pl): ============================ use XML::LibXML; my $d = XML::LibXML->new()->parse_string(q~<x:a xmlns:x="http://x.com"><x1:a xmlns:x1="http://x1.com"/></x:a>~); my $x = XML::LibXML::XPathContext->new; $x->registerNs($ARGV[1], 'http://x.com'); $x->registerNs($ARGV[2], 'http://x1.com'); warn($x->findnodes($ARGV[0],$d->documentElement)); ============================ Execute script with arguments like below. The first execution demonstrates bug. Pay attention that prefixes are registered back to front against in xml. The second one works fine (just for comparison). ============================ [root@localhost libxml]# perl 1.pl '//x1:a/x:a' x1 x Warning: something's wrong at 1.pl line 6. [root@localhost libxml]# [root@localhost libxml]# perl 1.pl '//y1:a/y:a' y1 y XML::LibXML::Element=SCALAR(0x8e8e130) at 1.pl line 6. [root@localhost libxml]# ============================ III) INFO ACCORDING rt.cpan.org: a) Distribution name and version: XML-LibXML-1.65 (as well XML-LibXML-1.64) libxml2-2.6.30-1 b) Perl version This is perl, v5.8.8 built for i386-linux-thread-multi c) Operating System vendor and version cat /etc/redhat-release Red Hat Enterprise Linux Server release 5 (Tikanga)
The bug is in XML::LibXML's which allows the user to use per-document NS declarations in XPath expressions by pre-registering them on user's behalf. Not yet sure how to address this yet (but I promiss to so before I release 1.66). -- Petr
This is now fixed in the SVN, 1.66 coming soon. Dne čt 25.říj.2007 08:26:29, PAJAS napsal(a): Show quoted text
> The bug is in XML::LibXML's which allows the user to use per-document > NS declarations in XPath expressions by pre-registering them on
user's Show quoted text
> behalf. Not yet sure how to address this yet (but I promiss to so > before I release 1.66). > > -- Petr