Skip Menu |

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

Report information
The Basics
Id: 11648
Status: resolved
Priority: 0/
Queue: XML-DOM-XPath

People
Owner: MIROD [...] cpan.org
Requestors: yishayjobs [...] hotmail.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.07
Fixed in: 0.08



Subject: > operator
XML-DOM-XPath version 0.07 OS: winXP perl -v: 5.8.4 description: some xpath expressions containing '>', '>=', '<', '<=' operators trigger an error: Can't locate object method "to_number" via package "XML::DOM::Element" at C:/Perl/site/lib/XML/XPath/Expr.pm line 450. ('=' operator seems to work fine on same cases) Example code: ======== <code> use XML::DOM::XPath; my $xmlStr = q{<?xml version="1.0" encoding="ISO-8859-1"?> <catalog> <cd country="USA"> <title>Empire Burlesque</title> <artist>Bob Dylan</artist> <price>10.90</price> </cd> <cd country="UK"> <title>Hide your heart</title> <artist>Bonnie Tyler</artist> <price>8.70</price> </cd> <cd country="USA"> <title>Greatest Hits</title> <artist>Dolly Parton</artist> <price>9.90</price> </cd> </catalog>}; my $dom = XML::DOM::Parser->new(); my $doc = $dom->parse($xmlStr); # '/catalog/cd[price=9.90]' works but '/catalog/cd[price<9.90]' doesn't foreach my $node ($doc->findnodes('/catalog/cd[price<9.90]') ) { print $node->getAttribute('country'), "\n"; } </code> ===================
[guest - Thu Feb 24 03:24:54 2005]: Show quoted text
> XML-DOM-XPath version 0.07 > some xpath expressions containing '>', '>=', '<', > '<=' operators
trigger an error: Indeed I did not have the to_number method on all kinds of nodes. I think I fixed it. Could you test the development version at http://www.xmltwig.com/module/xml-dom-xpath/ and see if the bug is fixed for you? Thanks, and thanks for the test case. __ Mirod
[MIROD - Thu Feb 24 08:18:30 2005]: Show quoted text
> [guest - Thu Feb 24 03:24:54 2005]: >
> > XML-DOM-XPath version 0.07 > > some xpath expressions containing '>', '>=', '<', > '<=' operators
> trigger an error: > > Indeed I did not have the to_number method on all kinds of nodes. I > think I fixed it. > > Could you test the development version at > http://www.xmltwig.com/module/xml-dom-xpath/ and see if the bug is
fixed Show quoted text
> for you? > > Thanks, and thanks for the test case. > __ > Mirod
Hi, I checked my script (WinXP, perl -v 5.8.4 ) with '>', '<', '>=', '<=' and all expressions gave good results. Your unit tests don't all pass, but you're probably aware of that since you called it a development version. I've already integrated your module in our project. Thanks for the quick response, Yishay
[guest - Sun Feb 27 03:28:21 2005]: Show quoted text
> Your unit tests don't all pass, > but you're probably aware of that since you called it a development > version. I've already integrated your module in our project.
Do you have the tests output? They all pass on my machine (which use a patched version of XML::XPath, see http://rt.cpan.org/Ticket/Display.html?id=6363). __ Mirod
Show quoted text
> > Do you have the tests output? They all pass on my machine (which use
See attached STDOUT. (mostly) STDERR is below. ====== C:\temp\XML-DOM-XPath-0.08>nmake test > out.txt Microsoft (R) Program Maintenance Utility Version 1.50 Copyright (c) Microsoft Corp 1988-94. All rights reserved. # Failed test (t\test_bugs.t at line 50) # got: 'e1e3e4' # expected: 'e1e3' # Looks like you failed 1 tests of 9. Failed 1/31 test scripts, 96.77% okay. 1/165 subtests failed, 99.39% okay. NMAKE : fatal error U1077: 'C:\WINDOWS\system32\cmd.exe' : return code '0xff' Stop. C:\temp\XML-DOM-XPath-0.08> =========== Show quoted text
> patched version of XML::XPath, see > http://rt.cpan.org/Ticket/Display.html?id=6363). > > __ > Mirod
No luck following below link (I get 'Welcome to rt.cpan.org' page). I simply used XML-DOM-XPath-0.08.tar.gz from http://www.xmltwig.com/module/xml-dom-xpath/
C:\Perl\bin\perl.exe "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib\lib', 'blib\arch')" t\1.t t\test_bugs.t t\xmlxpath_01basic.t t\xmlxpath_02descendant.t t\xmlxpath_03star.t t\xmlxpath_04pos.t t\xmlxpath_05attrib.t t\xmlxpath_06attrib_val.t t\xmlxpath_07count.t t\xmlxpath_08name.t t\xmlxpath_09a_string_length.t t\xmlxpath_09string_length.t t\xmlxpath_10pipe.t t\xmlxpath_12axisdescendant.t t\xmlxpath_13axisparent.t t\xmlxpath_14axisancestor.t t\xmlxpath_15axisfol_sib.t t\xmlxpath_16axisprec_sib.t t\xmlxpath_17axisfollowing.t t\xmlxpath_18axispreceding.t t\xmlxpath_19axisd_or_s.t t\xmlxpath_20axisa_or_s.t t\xmlxpath_21allnodes.t t\xmlxpath_22name_select.t t\xmlxpath_23func.t t\xmlxpath_24namespaces.t t\xmlxpath_25scope.t t\xmlxpath_26predicate.t t\xmlxpath_28ancestor2.t t\xmlxpath_29desc_with_predicate.t t\xmlxpath_30lang.t t\1.................................ok t\test_bugs.........................dubious Test returned status 1 (wstat 256, 0x100) DIED. FAILED test 7 Failed 1/9 tests, 88.89% okay t\xmlxpath_01basic..................ok t\xmlxpath_02descendant.............ok t\xmlxpath_03star...................ok t\xmlxpath_04pos....................ok t\xmlxpath_05attrib.................ok t\xmlxpath_06attrib_val.............ok t\xmlxpath_07count..................ok t\xmlxpath_08name...................ok t\xmlxpath_09a_string_length........ok t\xmlxpath_09string_length..........ok t\xmlxpath_10pipe...................ok t\xmlxpath_12axisdescendant.........ok t\xmlxpath_13axisparent.............ok t\xmlxpath_14axisancestor...........ok t\xmlxpath_15axisfol_sib............ok t\xmlxpath_16axisprec_sib...........ok t\xmlxpath_17axisfollowing..........ok t\xmlxpath_18axispreceding..........ok t\xmlxpath_19axisd_or_s.............ok t\xmlxpath_20axisa_or_s.............ok t\xmlxpath_21allnodes...............ok t\xmlxpath_22name_select............ok t\xmlxpath_23func...................ok t\xmlxpath_24namespaces.............ok t\xmlxpath_25scope..................ok t\xmlxpath_26predicate..............ok t\xmlxpath_28ancestor2..............ok t\xmlxpath_29desc_with_predicate....ok t\xmlxpath_30lang...................ok Failed Test Stat Wstat Total Fail Failed List of Failed ------------------------------------------------------------------------------- t\test_bugs.t 1 256 9 1 11.11% 7
Date: Wed, 02 Mar 2005 11:08:03 +0100
From: Michel Rodriguez <mirod [...] xmltwig.com>
To: bug-XML-DOM-XPath [...] rt.cpan.org
Subject: Re: [cpan #11648] > operator
RT-Send-Cc:
Guest via RT wrote: Show quoted text
> # Failed test (t\test_bugs.t at line 50) > # got: 'e1e3e4' > # expected: 'e1e3' > # Looks like you failed 1 tests of 9. > Failed 1/31 test scripts, 96.77% okay. 1/165 subtests failed, 99.39% > okay. > NMAKE : fatal error U1077: 'C:\WINDOWS\system32\cmd.exe' : return > code '0xff' > Stop. > > C:\temp\XML-DOM-XPath-0.08>
There is a long standing bug in XML::XPath, that makes < behave like <= (and similarly I think <= behave like <). This bug is triggered by the new test case. The RT thread about it (with mostly 1 participant ;--) should be visible at http://rt.cpan.org/NoAuth/Bug.html?id=6363 The new test to verify that the bug you reported was fixed also triggered this bug (I had forgotten about it!). I decided to let the test as is, but to add a warning and a reference to the patched version of XML::XPath when the buggy result is returned. Does it make sense? The new version is on my site, and if it now passes for you, then I'll release it. Thanks -- mirod