r35811 - in /branches/upstream/libxml-xpathengine-perl/current: Changes META.yml lib/XML/XPathEngine.pm lib/XML/XPathEngine/NodeSet.pm t/01_basic.t t/minitree.pm

ryan52-guest at users.alioth.debian.org ryan52-guest at users.alioth.debian.org
Tue May 19 05:25:20 UTC 2009


Author: ryan52-guest
Date: Tue May 19 05:25:15 2009
New Revision: 35811

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=35811
Log:
[svn-upgrade] Integrating new upstream version, libxml-xpathengine-perl (0.12)

Modified:
    branches/upstream/libxml-xpathengine-perl/current/Changes
    branches/upstream/libxml-xpathengine-perl/current/META.yml
    branches/upstream/libxml-xpathengine-perl/current/lib/XML/XPathEngine.pm
    branches/upstream/libxml-xpathengine-perl/current/lib/XML/XPathEngine/NodeSet.pm
    branches/upstream/libxml-xpathengine-perl/current/t/01_basic.t
    branches/upstream/libxml-xpathengine-perl/current/t/minitree.pm

Modified: branches/upstream/libxml-xpathengine-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-xpathengine-perl/current/Changes?rev=35811&op=diff
==============================================================================
--- branches/upstream/libxml-xpathengine-perl/current/Changes (original)
+++ branches/upstream/libxml-xpathengine-perl/current/Changes Tue May 19 05:25:15 2009
@@ -1,6 +1,9 @@
 Revision history for XML::XPathEngine
 
-version 011
+version 0.12
+added:  findvalues method which returns the results as a list of strings
+
+version 0.11
 fix:    axis_descendant returns descendants in incorrect order.
         found and patched by Kumagai Kentaro
         http://rt.cpan.org/Ticket/Display.html?id=35049

Modified: branches/upstream/libxml-xpathengine-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-xpathengine-perl/current/META.yml?rev=35811&op=diff
==============================================================================
--- branches/upstream/libxml-xpathengine-perl/current/META.yml (original)
+++ branches/upstream/libxml-xpathengine-perl/current/META.yml Tue May 19 05:25:15 2009
@@ -1,11 +1,11 @@
 --- #YAML:1.0
 name:                XML-XPathEngine
-version:             0.11
+version:             0.12
 abstract:            a re-usable XPath engine for DOM-like trees
 license:             ~
 author:              
     - Michel Rodriguez <mirod at cpan.org>
-generated_by:        ExtUtils::MakeMaker version 6.44
+generated_by:        ExtUtils::MakeMaker version 6.42
 distribution_type:   module
 requires:     
     Test::More:                    0

Modified: branches/upstream/libxml-xpathengine-perl/current/lib/XML/XPathEngine.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-xpathengine-perl/current/lib/XML/XPathEngine.pm?rev=35811&op=diff
==============================================================================
--- branches/upstream/libxml-xpathengine-perl/current/lib/XML/XPathEngine.pm (original)
+++ branches/upstream/libxml-xpathengine-perl/current/lib/XML/XPathEngine.pm Tue May 19 05:25:15 2009
@@ -5,7 +5,7 @@
 
 use vars qw($VERSION $AUTOLOAD $revision);
 
-$VERSION = '0.11';
+$VERSION = '0.12';
 $XML::XPathEngine::Namespaces = 0;
 $XML::XPathEngine::DEBUG = 0;
 
@@ -164,6 +164,16 @@
       #{ return $results->to_literal; }
     return $results->value;
 }
+
+sub findvalues {
+    my $self = shift;
+    my ($path, $context) = @_;
+    my $results = $self->find( $path, $context);
+    if ($results->isa('XML::XPathEngine::NodeSet')) 
+      { return $results->string_values; }
+    return ($results->string_value);
+}
+
 
 sub exists
 {
@@ -1054,6 +1064,10 @@
 Returns the result as a string (the concatenation of the values of the
 result nodes).
 
+=head2 findvalues($path, $context)
+
+Returns the values of the result nodes as a list of strings.
+
 =head2 exists ($path, $context)
 
 Returns true if the given path exists.

Modified: branches/upstream/libxml-xpathengine-perl/current/lib/XML/XPathEngine/NodeSet.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-xpathengine-perl/current/lib/XML/XPathEngine/NodeSet.pm?rev=35811&op=diff
==============================================================================
--- branches/upstream/libxml-xpathengine-perl/current/lib/XML/XPathEngine/NodeSet.pm (original)
+++ branches/upstream/libxml-xpathengine-perl/current/lib/XML/XPathEngine/NodeSet.pm Tue May 19 05:25:15 2009
@@ -131,11 +131,15 @@
 			);
 }
 
-sub to_final_value{
+sub to_final_value {
 	my $self = CORE::shift;
 	return join('', map { $_->string_value } @$self);
 }
 
+sub string_values {
+	my $self = CORE::shift;
+	return map { $_->string_value } @$self;
+}
 1;
 __END__
 
@@ -177,6 +181,11 @@
 Returns the string-value of the first node in the list.
 See the XPath specification for what "string-value" means.
 
+=head2 string_values()
+
+Returns a list of the string-values of all the nodes in the list.
+
+
 =head2 to_literal()
 
 Returns the concatenation of all the string-values of all

Modified: branches/upstream/libxml-xpathengine-perl/current/t/01_basic.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-xpathengine-perl/current/t/01_basic.t?rev=35811&op=diff
==============================================================================
--- branches/upstream/libxml-xpathengine-perl/current/t/01_basic.t (original)
+++ branches/upstream/libxml-xpathengine-perl/current/t/01_basic.t Tue May 19 05:25:15 2009
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 31;
+use Test::More tests => 33;
 use XML::XPathEngine;
 
 BEGIN { push @INC, './t'; }
@@ -12,6 +12,7 @@
 my $xp   = XML::XPathEngine->new;
 
 #warn $tree->as_xml, "\n\n";
+
 {
 my @root_nodes= $xp->findnodes( '/root', $tree);
 is( join( ':', map { $_->value } @root_nodes), 'root_value', q{findnodes( '/root', $tree)});
@@ -68,6 +69,9 @@
 is( $xp->findvalue( 'id("i3")//*[1]/@att2', $tree), 'vv', 'id descendants attribute');
 is( $xp->findvalue( '(id("i3")//*)[1]/@att2', $tree), 'vv', 'grouped id descendants attribute');
 is( $xp->findvalue( 'substring-after((id("i2")//*[1])/@att2, "v")', $tree), 'v', 'substring-after(id())');
+
+is( join( '|', $xp->findvalues( '//kid1[@att1=~/v[345]/]', $tree)), 'vkid3|vkid5', "findvalues match on attributes");
+is( join( '|', $xp->findvalues( '//kid1[@att1=~/v[345]/]/@id', $tree)), 'i9|i15', "findvalues on attributes");
 
 sub init_tree
   { my $id=0;

Modified: branches/upstream/libxml-xpathengine-perl/current/t/minitree.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-xpathengine-perl/current/t/minitree.pm?rev=35811&op=diff
==============================================================================
--- branches/upstream/libxml-xpathengine-perl/current/t/minitree.pm (original)
+++ branches/upstream/libxml-xpathengine-perl/current/t/minitree.pm Tue May 19 05:25:15 2009
@@ -88,12 +88,9 @@
 
   sub dump
     { my $self= shift;
+      my @fields= qw( name value pos);
       return   "$$self : " 
-      # . join ( " - ", grep { $_ } map { "$_ : " . ${$self->$_} if( $self->$_) }  
-      #                                       qw( parent next_sibling previous_sibling first_child)
-      #             )
-      #      . ' : '
-             . join ( " - ", map { "$_ : " . $self->$_ }  (qw( name value pos)) )
+             . join ( " - ", map { "$_ : " . $self->$_ }  @fields )
              . " : " . join( " - ", map { $_->dump } @{$self->attributes})
              ;
     }




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