Skip Menu |
 

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

Report information
The Basics
Id: 15671
Status: resolved
Priority: 0/
Queue: XML-Twig

People
Owner: Nobody in particular
Requestors: grousse [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 3.22
Fixed in: 3.23



Subject: wrong condition interpretation for attribute value 0
condition '*[@att="0"]' doesn't work, as demonstrated by the attached test case.
Download test.pl
text/x-perl 293b
#!/usrb/bin/perl use XML::Twig; my $twig = XML::Twig->new(); $twig->parse(\*DATA); my $root = $twig->root(); print scalar $root->children('*[@id="0"]'); print scalar $root->children('*[@id="1"]'); __DATA__ <?xml version="1.0" encoding="ISO-8859-1"?> <foo> <bar id="0"/> <bar id="1"/> </foo>
Download (untitled) / with headers
text/plain 311b
[GROUSSE - Thu Nov 10 07:38:03 2005]: Show quoted text
> condition '*[@att="0"]' doesn't work, as demonstrated by the attached > test case.
The culprit is line 4301 (and similar ones): ( (\$_[0]->{'att'}->{"$att"}||'') $op $string) should be ( (defined \$_[0]->{'att'}->{"$att"} ? \$_[0]->{'att'}->{"$att"} : '') $op $string)
Date: Thu, 10 Nov 2005 14:43:42 +0100
From: Michel Rodriguez <mirod [...] xmltwig.com>
To: bug-XML-Twig [...] rt.cpan.org
Subject: Re: [cpan #15671] wrong condition interpretation for attribute value 0
RT-Send-Cc:
Download (untitled) / with headers
text/plain 726b
via RT wrote: Show quoted text
> This message about XML-Twig was sent to you by GROUSSE <GROUSSE@cpan.org> via rt.cpan.org > > Full context and any attached attachments can be found at: > <URL: https://rt.cpan.org/Ticket/Display.html?id=15671 > > > [GROUSSE - Thu Nov 10 07:38:03 2005]: > >
>>condition '*[@att="0"]' doesn't work, as demonstrated by the attached >>test case.
> > > > The culprit is line 4301 (and similar ones): > ( (\$_[0]->{'att'}->{"$att"}||'') $op $string) > should be > ( (defined \$_[0]->{'att'}->{"$att"} ? \$_[0]->{'att'}->{"$att"} : '') > $op $string) >
Thanks, yes I see that, I have to fix a whole bunch of those actually. I really need the // operator! -- Michel Rodriguez Perl &amp; XML xmltwig.com
Date: Thu, 10 Nov 2005 15:39:19 +0100
From: Michel Rodriguez <mirod [...] xmltwig.com>
To: bug-XML-Twig [...] rt.cpan.org
Subject: Re: [cpan #15671] wrong condition interpretation for attribute value 0
RT-Send-Cc:
Download (untitled) / with headers
text/plain 728b
via RT wrote: Show quoted text
> This message about XML-Twig was sent to you by GROUSSE <GROUSSE@cpan.org> via rt.cpan.org > > Full context and any attached attachments can be found at: > <URL: https://rt.cpan.org/Ticket/Display.html?id=15671 > > > [GROUSSE - Thu Nov 10 07:38:03 2005]: > >
>>condition '*[@att="0"]' doesn't work, as demonstrated by the attached >>test case.
> > > > The culprit is line 4301 (and similar ones): > ( (\$_[0]->{'att'}->{"$att"}||'') $op $string) > should be > ( (defined \$_[0]->{'att'}->{"$att"} ? \$_[0]->{'att'}->{"$att"} : '') > $op $string)
This doen't work, it would return false for @att != "foo" when there is no att attribute for the element. -- Michel Rodriguez Perl &amp; XML xmltwig.com
The development version should be fixed, let me know if it works for you. Thanks __ mirod


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.