r18663 - in /branches/upstream/libxml-dom-xpath-perl/current: Changes META.yml Makefile.PL XPath.pm t/test_bugs.t t/test_non_ascii.t t/xmlxpath_24namespaces.t

gregoa-guest at users.alioth.debian.org gregoa-guest at users.alioth.debian.org
Wed Apr 16 15:06:27 UTC 2008


Author: gregoa-guest
Date: Wed Apr 16 15:06:26 2008
New Revision: 18663

URL: http://svn.debian.org/wsvn/?sc=1&rev=18663
Log:
[svn-upgrade] Integrating new upstream version, libxml-dom-xpath-perl (0.14)

Modified:
    branches/upstream/libxml-dom-xpath-perl/current/Changes
    branches/upstream/libxml-dom-xpath-perl/current/META.yml
    branches/upstream/libxml-dom-xpath-perl/current/Makefile.PL
    branches/upstream/libxml-dom-xpath-perl/current/XPath.pm
    branches/upstream/libxml-dom-xpath-perl/current/t/test_bugs.t
    branches/upstream/libxml-dom-xpath-perl/current/t/test_non_ascii.t
    branches/upstream/libxml-dom-xpath-perl/current/t/xmlxpath_24namespaces.t

Modified: branches/upstream/libxml-dom-xpath-perl/current/Changes
URL: http://svn.debian.org/wsvn/branches/upstream/libxml-dom-xpath-perl/current/Changes?rev=18663&op=diff
==============================================================================
--- branches/upstream/libxml-dom-xpath-perl/current/Changes (original)
+++ branches/upstream/libxml-dom-xpath-perl/current/Changes Wed Apr 16 15:06:26 2008
@@ -1,11 +1,23 @@
 Revision history for Perl extension XML::DOM::XPath.
 
 $Id: Changes,v 1.8 2005/10/18 08:39:04 mrodrigu Exp $
+
+0.14
+  - upgraded dependency to XML::XPathEngine 1.10
+  - added the findnodes_as_strings method, that returns a list of 
+    strings, one for each matching node 
+  - fixed RT #29423, test failing on Debian
+    see http://rt.cpan.org/Ticket/Display.html?id=29423
+  - added tests for bugs fixed in XML::XPathEngine 1.10
 
 0.13
 
   - removed dependency on XML::XPath in tests (spotted by
     Sendu Bala)
+
+  - added warning for test failure due to using XML::Parser
+    and XML::DOM from a previous version of perl, compiled
+    with different options (spotted by Tony Awtrey)
 
 0.12
 

Modified: branches/upstream/libxml-dom-xpath-perl/current/META.yml
URL: http://svn.debian.org/wsvn/branches/upstream/libxml-dom-xpath-perl/current/META.yml?rev=18663&op=diff
==============================================================================
--- branches/upstream/libxml-dom-xpath-perl/current/META.yml (original)
+++ branches/upstream/libxml-dom-xpath-perl/current/META.yml Wed Apr 16 15:06:26 2008
@@ -1,12 +1,15 @@
-# http://module-build.sourceforge.net/META-spec.html
-#XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
-name:         XML-DOM-XPath
-version:      0.13
-version_from: XPath.pm
-installdirs:  site
-requires:
+--- #YAML:1.0
+name:                XML-DOM-XPath
+version:             0.14
+abstract:            Perl extension to add XPath support to XML::DOM, using XML::XPath engine
+license:             ~
+author:              
+    - Michel Rodriguez <mirod at cpan.org>
+generated_by:        ExtUtils::MakeMaker version 6.44
+distribution_type:   module
+requires:     
     XML::DOM:                      0
-    XML::XPathEngine:              0.04
-
-distribution_type: module
-generated_by: ExtUtils::MakeMaker version 6.17
+    XML::XPathEngine:              0.1
+meta-spec:
+    url:     http://module-build.sourceforge.net/META-spec-v1.3.html
+    version: 1.3

Modified: branches/upstream/libxml-dom-xpath-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/branches/upstream/libxml-dom-xpath-perl/current/Makefile.PL?rev=18663&op=diff
==============================================================================
--- branches/upstream/libxml-dom-xpath-perl/current/Makefile.PL (original)
+++ branches/upstream/libxml-dom-xpath-perl/current/Makefile.PL Wed Apr 16 15:06:26 2008
@@ -6,7 +6,7 @@
 WriteMakefile(
     NAME              => 'XML::DOM::XPath',
     VERSION_FROM      => 'XPath.pm', # finds $VERSION
-    PREREQ_PM         => { XML::DOM => 0, XML::XPathEngine => 0.04 }, # e.g., Module::Name => 1.1
+    PREREQ_PM         => { XML::DOM => 0, XML::XPathEngine => 0.10 }, # e.g., Module::Name => 1.1
     ($] >= 5.005 ?     ## Add these new keywords supported since 5.005
       (ABSTRACT_FROM  => 'XPath.pm', # retrieve abstract from module
        AUTHOR         => 'Michel Rodriguez <mirod at cpan.org>') : ()),

Modified: branches/upstream/libxml-dom-xpath-perl/current/XPath.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libxml-dom-xpath-perl/current/XPath.pm?rev=18663&op=diff
==============================================================================
--- branches/upstream/libxml-dom-xpath-perl/current/XPath.pm (original)
+++ branches/upstream/libxml-dom-xpath-perl/current/XPath.pm Wed Apr 16 15:06:26 2008
@@ -8,7 +8,7 @@
 use XML::DOM;
 
 use vars qw($VERSION);
-$VERSION="0.13";
+$VERSION="0.14";
 
 my $xp_field;     # the field in the document that contains the XML::XPathEngine object
 my $parent_field; # the field in an attribute that contains the parent element
@@ -21,13 +21,14 @@
 
 package XML::DOM::Document;
 
-sub findnodes           { my( $dom, $path)= @_; return $dom->xp->findnodes(           $path, $dom); }
-sub findnodes_as_string { my( $dom, $path)= @_; return $dom->xp->findnodes_as_string( $path, $dom); }
-sub findvalue           { my( $dom, $path)= @_; return $dom->xp->findvalue(           $path, $dom); }
-sub exists              { my( $dom, $path)= @_; return $dom->xp->exists(              $path, $dom); }
-sub find                { my( $dom, $path)= @_; return $dom->xp->find(                $path, $dom); }
-sub matches             { my( $dom, $path)= @_; return $dom->xp->matches( $dom, $path, $dom); }
-sub set_namespace       { my $dom= shift; $dom->xp->set_namespace( @_); }
+sub findnodes            { my( $dom, $path)= @_; return $dom->xp->findnodes(            $path, $dom); }
+sub findnodes_as_string  { my( $dom, $path)= @_; return $dom->xp->findnodes_as_string(  $path, $dom); }
+sub findnodes_as_strings { my( $dom, $path)= @_; return $dom->xp->findnodes_as_strings( $path, $dom); }
+sub findvalue            { my( $dom, $path)= @_; return $dom->xp->findvalue(            $path, $dom); }
+sub exists               { my( $dom, $path)= @_; return $dom->xp->exists(               $path, $dom); }
+sub find                 { my( $dom, $path)= @_; return $dom->xp->find(                 $path, $dom); }
+sub matches              { my( $dom, $path)= @_; return $dom->xp->matches( $dom, $path, $dom); }
+sub set_namespace        { my $dom= shift; $dom->xp->set_namespace( @_); }
 
 sub cmp { return $_[1]->isa( 'XML::DOM::Document') ? 0 : 1; }
 

Modified: branches/upstream/libxml-dom-xpath-perl/current/t/test_bugs.t
URL: http://svn.debian.org/wsvn/branches/upstream/libxml-dom-xpath-perl/current/t/test_bugs.t?rev=18663&op=diff
==============================================================================
--- branches/upstream/libxml-dom-xpath-perl/current/t/test_bugs.t (original)
+++ branches/upstream/libxml-dom-xpath-perl/current/t/test_bugs.t Wed Apr 16 15:06:26 2008
@@ -4,7 +4,7 @@
 # $Id: test_bugs.t,v 1.6 2005/03/08 09:08:42 mrodrigu Exp $
 
 
-use Test::More tests => 13;
+use Test::More tests => 21;
 
 use XML::DOM::XPath;
 ok(1, "use XML::DOM::XPath");
@@ -92,3 +92,58 @@
       { is( $doc->findvalue( '//processing-instruction()'), 'd1d2d3', '//processing-instruction()'); }
 }
 
+{
+my $xml=qq|<?xml version="1.0" encoding="utf-8"?>
+<cdl><structure><assessments>
+<component type="labtasks" name="Lab Tasks" id="labtasks"    weight="40"/>
+<component type="exam"       name="Mid Term Exam"    id="midterm" weight="20"/>
+<component type="exam"       name="End Term Exam"  id="endterm" weight="40"/>
+</assessments></structure></cdl>
+|;
+
+
+  my $xp = XML::DOM::Parser->new->parsestring($xml);
+
+  is( $xp->findvalue( 'count( //component)'), 3, 'count on its own');
+  is( 2 * $xp->findvalue( 'count( //component)'), 6, '2 * count');
+  is( $xp->findvalue( 'count( //component)') * 2, 6, 'count * 2');
+
+  {
+    my $component= ($xp->findnodes ('//structure//assessments/component'))[0]; 
+    my $id = $component->findvalue ('@id');
+    my $weight= $component->findvalue ('@weight');
+    my $res=  100 * $weight;	# this is where things failed
+    is( $res, 4000, 'findvalue result used in an multiplication');
+  }
+
+  {
+    my $weight=($xp->findnodes_as_strings ('//structure//assessments/component/@weight'))[0]; 
+    my $res= 100 * $weight;	# this is where things failed
+    is( $res, 4000, 'findvalue result used in an multiplication');
+  }
+}
+
+{
+  my $xml=qq|
+<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>
+|;
+
+  my $xp = XML::DOM::Parser->new->parsestring( $xml);
+  ok($xp);
+
+  # Debian bug #187583, http://bugs.debian.org/187583
+  # Check that evaluation doesn't lose the context information
+
+  my $nodes = $xp->find("text/para/node()[position()=last() and preceding-sibling::important]");
+  ok("$nodes", " has a preceding sibling.");
+
+  $nodes = $xp->find("text/para/node()[preceding-sibling::important and position()=last()]");
+  ok("$nodes", " has a preceding sibling.");
+}

Modified: branches/upstream/libxml-dom-xpath-perl/current/t/test_non_ascii.t
URL: http://svn.debian.org/wsvn/branches/upstream/libxml-dom-xpath-perl/current/t/test_non_ascii.t?rev=18663&op=diff
==============================================================================
--- branches/upstream/libxml-dom-xpath-perl/current/t/test_non_ascii.t (original)
+++ branches/upstream/libxml-dom-xpath-perl/current/t/test_non_ascii.t Wed Apr 16 15:06:26 2008
@@ -7,16 +7,19 @@
 use Test::More tests => 10;
 use XML::DOM::XPath;
 
-use utf8;
+use encoding 'utf8';
+
+my $display_warning=0;
 
 { 
   my $dom = XML::DOM::Parser->new();
   my $doc = $dom->parsefile( "t/non_ascii.xml");
-  is( $doc->toString, qq{<doc><ent>aü</ent><char>bü</char></doc>\n},'toString (on file)');
+  if( !$doc->toString eq "<doc><ent>aü</ent><char>bü</char></doc>\n") { $display_warning=1; }
+  is( $doc->toString, "<doc><ent>aü</ent><char>bü</char></doc>\n",'toString (on file)');
   is( $doc->findvalue( '//char'), "bü", "findvalue( '//char') (on file)");
-  is( $doc->findnodes_as_string( '//char'), qq{<char>bü</char>}, "findnodes_as_string( '//char') (on file)");
-  is( $doc->findvalue( '//ent'), qq{aü}, "findvalue( '//ent') (on file)");
-  is( $doc->findnodes_as_string( '//ent'), qq{<ent>aü</ent>}, "findnodes_as_string( '//ent') (on file)");
+  is( $doc->findnodes_as_string( '//char'), '<char>bü</char>', "findnodes_as_string( '//char') (on file)");
+  is( $doc->findvalue( '//ent'), 'aü', "findvalue( '//ent') (on file)");
+  is( $doc->findnodes_as_string( '//ent'), '<ent>aü</ent>', "findnodes_as_string( '//ent') (on file)");
 }
 
 
@@ -31,4 +34,10 @@
   is( $doc->findnodes_as_string( '//ent'), qq{<ent>aü</ent>}, "findnodes_as_string( '//ent') (on string)");
 }
 
-
+if( $display_warning)
+  { warn "One possible reason why this test might fail is if XML::Parser and XML::DOM were\n",
+         "installed with a different version of perl, compiled with a different set of options.\n",
+         "For example upgrading Ubuntu from Dapper Drake to Edgy Eft will cause this test to fail.\n",
+         "Re-installing XML::Parser and XML::DOM will fix the problem.\n"
+         ;
+  }

Modified: branches/upstream/libxml-dom-xpath-perl/current/t/xmlxpath_24namespaces.t
URL: http://svn.debian.org/wsvn/branches/upstream/libxml-dom-xpath-perl/current/t/xmlxpath_24namespaces.t?rev=18663&op=diff
==============================================================================
--- branches/upstream/libxml-dom-xpath-perl/current/t/xmlxpath_24namespaces.t (original)
+++ branches/upstream/libxml-dom-xpath-perl/current/t/xmlxpath_24namespaces.t Wed Apr 16 15:06:26 2008
@@ -2,7 +2,7 @@
 use strict;
 
 use Test;
-plan( tests => 12);
+plan( tests => 15);
 use XML::DOM::XPath;
 ok(1);
 
@@ -28,8 +28,12 @@
 $node= $t->findvalue( '//*[@attr:findme]');
 ok( $node, 'attr content');
 
+ok( $t->findvalue('//attr:node/@attr:findme'), 'someval');
+
+ok( $t->findvalue( '//toto'), 'tata');
+ok( $t->findvalue( '//toto/@att'), 'tutu');
+
 # Set namespace mappings.
-
 
 $t->set_namespace("foo" => "flubber.example.com");
 $t->set_namespace("goo" => "foobar.example.com");




More information about the Pkg-perl-cvs-commits mailing list