commit perl-XML-XPath for openSUSE:Factory
Hello community, here is the log from the commit of package perl-XML-XPath for openSUSE:Factory checked in at 2016-01-17 09:23:01 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-XML-XPath (Old) and /work/SRC/openSUSE:Factory/.perl-XML-XPath.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "perl-XML-XPath" Changes: -------- --- /work/SRC/openSUSE:Factory/perl-XML-XPath/perl-XML-XPath.changes 2016-01-12 16:10:55.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.perl-XML-XPath.new/perl-XML-XPath.changes 2016-01-17 09:23:02.000000000 +0100 @@ -1,0 +2,12 @@ +Wed Jan 13 10:42:00 UTC 2016 - coolo@suse.com + +- updated to 1.21 + see /usr/share/doc/packages/perl-XML-XPath/Changes + + 1.21 2016-01-12 MANWAR + - Fixed issues RT# 14957 and RT# 30819. + + 1.20 2016-01-10 MANWAR + - Fixed issues RT# 26143 and RT# 68703. + +------------------------------------------------------------------- Old: ---- XML-XPath-1.19.tar.gz New: ---- XML-XPath-1.21.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-XML-XPath.spec ++++++ --- /var/tmp/diff_new_pack.XFXWBs/_old 2016-01-17 09:23:03.000000000 +0100 +++ /var/tmp/diff_new_pack.XFXWBs/_new 2016-01-17 09:23:03.000000000 +0100 @@ -17,7 +17,7 @@ Name: perl-XML-XPath -Version: 1.19 +Version: 1.21 Release: 0 %define cpan_name XML-XPath Summary: Set of Modules for Parsing and Evaluating Xpath Statements ++++++ XML-XPath-1.19.tar.gz -> XML-XPath-1.21.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/XML-XPath-1.19/Changes new/XML-XPath-1.21/Changes --- old/XML-XPath-1.19/Changes 2016-01-04 13:09:12.000000000 +0100 +++ new/XML-XPath-1.21/Changes 2016-01-12 11:37:46.000000000 +0100 @@ -1,5 +1,11 @@ Revision history for XML::XPath +1.21 2016-01-12 MANWAR + - Fixed issues RT# 14957 and RT# 30819. + +1.20 2016-01-10 MANWAR + - Fixed issues RT# 26143 and RT# 68703. + 1.19 2016-01-05 MANWAR - Fixed issues RT# 14248 and RT# 23924. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/XML-XPath-1.19/MANIFEST new/XML-XPath-1.21/MANIFEST --- old/XML-XPath-1.19/MANIFEST 2016-01-05 11:07:01.000000000 +0100 +++ new/XML-XPath-1.21/MANIFEST 2016-01-12 11:38:11.000000000 +0100 @@ -61,6 +61,14 @@ t/31dots.t t/32duplicate_nodes.t t/33getnodetext.t +t/34non_abbreviated_attrib.t +t/35namespace_uri.t +t/36substring.t +t/37concat.t +t/38starts_with.t +t/39contains.t +t/40substring_before.t +t/41substring_after.t t/rdf.t t/remove.t t/insert.t diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/XML-XPath-1.19/META.json new/XML-XPath-1.21/META.json --- old/XML-XPath-1.19/META.json 2016-01-05 11:07:01.000000000 +0100 +++ new/XML-XPath-1.21/META.json 2016-01-12 11:38:11.000000000 +0100 @@ -45,6 +45,6 @@ "web" : "https://github.com/manwar/XML-XPath" } }, - "version" : "1.19", + "version" : "1.21", "x_serialization_backend" : "JSON::PP version 2.27203" } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/XML-XPath-1.19/META.yml new/XML-XPath-1.21/META.yml --- old/XML-XPath-1.19/META.yml 2016-01-05 11:07:01.000000000 +0100 +++ new/XML-XPath-1.21/META.yml 2016-01-12 11:38:11.000000000 +0100 @@ -22,5 +22,5 @@ perl: '5.006' resources: repository: https://github.com/manwar/XML-XPath.git -version: '1.19' +version: '1.21' x_serialization_backend: 'CPAN::Meta::YAML version 0.012' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/XML-XPath-1.19/lib/XML/XPath/Boolean.pm new/XML-XPath-1.21/lib/XML/XPath/Boolean.pm --- old/XML-XPath-1.19/lib/XML/XPath/Boolean.pm 2016-01-04 12:57:20.000000000 +0100 +++ new/XML-XPath-1.21/lib/XML/XPath/Boolean.pm 2016-01-12 10:47:37.000000000 +0100 @@ -1,6 +1,6 @@ package XML::XPath::Boolean; -$VERSION = '1.19'; +$VERSION = '1.21'; use XML::XPath::Number; use XML::XPath::Literal; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/XML-XPath-1.19/lib/XML/XPath/Builder.pm new/XML-XPath-1.21/lib/XML/XPath/Builder.pm --- old/XML-XPath-1.19/lib/XML/XPath/Builder.pm 2016-01-04 12:57:28.000000000 +0100 +++ new/XML-XPath-1.21/lib/XML/XPath/Builder.pm 2016-01-12 10:47:45.000000000 +0100 @@ -1,6 +1,6 @@ package XML::XPath::Builder; -$VERSION = '1.19'; +$VERSION = '1.21'; use strict; use warnings; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/XML-XPath-1.19/lib/XML/XPath/Expr.pm new/XML-XPath-1.21/lib/XML/XPath/Expr.pm --- old/XML-XPath-1.19/lib/XML/XPath/Expr.pm 2016-01-04 12:57:38.000000000 +0100 +++ new/XML-XPath-1.21/lib/XML/XPath/Expr.pm 2016-01-12 10:47:54.000000000 +0100 @@ -1,6 +1,6 @@ package XML::XPath::Expr; -$VERSION = '1.19'; +$VERSION = '1.21'; use strict; use warnings; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/XML-XPath-1.19/lib/XML/XPath/Function.pm new/XML-XPath-1.21/lib/XML/XPath/Function.pm --- old/XML-XPath-1.19/lib/XML/XPath/Function.pm 2016-01-04 12:57:52.000000000 +0100 +++ new/XML-XPath-1.21/lib/XML/XPath/Function.pm 2016-01-12 10:48:01.000000000 +0100 @@ -1,6 +1,6 @@ package XML::XPath::Function; -$VERSION = '1.19'; +$VERSION = '1.21'; use XML::XPath::Number; use XML::XPath::Literal; @@ -145,7 +145,21 @@ sub namespace_uri { my $self = shift; my ($node, @params) = @_; - die "namespace-uri: Function not supported\n"; + + if (@params > 1) { + die "namespace_uri() function takes one or no parameters\n"; + } + elsif (@params) { + my $nodeset = shift(@params); + $node = $nodeset->get_node(1); + } + + # Sets to xmlns:[name]="namespace" or xmlns="namespace" + my $namespace = $node->getNamespace->toString; + # We only need data between the quotation marks + $namespace =~ /\"(.*?)\"/; + + return XML::XPath::Literal->new($1); } sub name { @@ -202,8 +216,10 @@ die "starts-with: incorrect number of params\n" unless @params == 2; my $value = $params[1]->string_value; if ($params[0]->string_value =~ /(.*?)\Q$value\E(.*)/) { - # $1 and $2 stored for substring funcs below - # TODO: Fix this nasty implementation! + # Store the values of contains1, contains2 for use in the + # substring functions below + $self->{contains1} = $1; + $self->{contains2} = $2; return XML::XPath::Boolean->True; } return XML::XPath::Boolean->False; @@ -214,7 +230,7 @@ my ($node, @params) = @_; die "starts-with: incorrect number of params\n" unless @params == 2; if ($self->contains($node, @params)->value) { - return XML::XPath::Literal->new($1); # hope that works! + return XML::XPath::Literal->new($self->{contains1}); } else { return XML::XPath::Literal->new(''); @@ -226,7 +242,7 @@ my ($node, @params) = @_; die "starts-with: incorrect number of params\n" unless @params == 2; if ($self->contains($node, @params)->value) { - return XML::XPath::Literal->new($2); + return XML::XPath::Literal->new($self->{contains2}); } else { return XML::XPath::Literal->new(''); @@ -240,11 +256,58 @@ my ($str, $offset, $len); $str = $params[0]->string_value; $offset = $params[1]->value; - $offset--; # uses 1 based offsets + + if ($offset eq 'NaN') { + return XML::XPath::Literal->new(''); + } + + require POSIX; if (@params == 3) { $len = $params[2]->value; + + if (($len eq 'NaN') || (($offset eq 'Infinity') && ($len eq 'Infinity'))) { + return XML::XPath::Literal->new(''); + } + + if ($offset ne 'Infinity') { + $offset--; # uses 1 based offsets + $offset = POSIX::floor($offset + 0.5); # round. + if ($offset < 0) { + if ($len ne 'Infinity') { + $len += $offset; + } + else { + $len = length($str); + } + $offset = 0; + } + else { + if ($len eq 'Infinity') { + return XML::XPath::Literal->new(''); + } + } + } + else { + return XML::XPath::Literal->new(''); + } + + if ($len eq 'Infinity') { + $len = length($str); + } + + $len = POSIX::floor($len + 0.5); # round. + + return XML::XPath::Literal->new(substr($str, $offset, $len)); + } else { + $offset--; # uses 1 based offsets + $offset = POSIX::floor($offset + 0.5); # round. + + if ($offset < 0) { + $offset = 0; + } + + return XML::XPath::Literal->new(substr($str, $offset)); } - return XML::XPath::Literal->new(substr($str, $offset, $len)); } sub string_length { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/XML-XPath-1.19/lib/XML/XPath/Literal.pm new/XML-XPath-1.21/lib/XML/XPath/Literal.pm --- old/XML-XPath-1.19/lib/XML/XPath/Literal.pm 2016-01-04 12:58:02.000000000 +0100 +++ new/XML-XPath-1.21/lib/XML/XPath/Literal.pm 2016-01-12 10:48:12.000000000 +0100 @@ -1,6 +1,6 @@ package XML::XPath::Literal; -$VERSION = '1.19'; +$VERSION = '1.21'; use XML::XPath::Boolean; use XML::XPath::Number; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/XML-XPath-1.19/lib/XML/XPath/LocationPath.pm new/XML-XPath-1.21/lib/XML/XPath/LocationPath.pm --- old/XML-XPath-1.19/lib/XML/XPath/LocationPath.pm 2016-01-04 12:58:12.000000000 +0100 +++ new/XML-XPath-1.21/lib/XML/XPath/LocationPath.pm 2016-01-12 10:48:20.000000000 +0100 @@ -1,6 +1,6 @@ package XML::XPath::LocationPath; -$VERSION = '1.19'; +$VERSION = '1.21'; use XML::XPath::Root; use strict; use warnings; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/XML-XPath-1.19/lib/XML/XPath/Node/Attribute.pm new/XML-XPath-1.21/lib/XML/XPath/Node/Attribute.pm --- old/XML-XPath-1.19/lib/XML/XPath/Node/Attribute.pm 2016-01-04 13:00:26.000000000 +0100 +++ new/XML-XPath-1.21/lib/XML/XPath/Node/Attribute.pm 2016-01-12 11:29:54.000000000 +0100 @@ -4,7 +4,7 @@ use vars qw/@ISA $VERSION/; @ISA = ('XML::XPath::Node'); -$VERSION = '1.19'; +$VERSION = '1.21'; package XML::XPath::Node::AttributeImpl; @@ -12,7 +12,7 @@ @ISA = ('XML::XPath::NodeImpl', 'XML::XPath::Node::Attribute'); use XML::XPath::Node ':node_keys'; -$VERSION = '1.19'; +$VERSION = '1.21'; sub new { my $class = shift; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/XML-XPath-1.19/lib/XML/XPath/Node/Comment.pm new/XML-XPath-1.21/lib/XML/XPath/Node/Comment.pm --- old/XML-XPath-1.19/lib/XML/XPath/Node/Comment.pm 2016-01-04 13:00:34.000000000 +0100 +++ new/XML-XPath-1.21/lib/XML/XPath/Node/Comment.pm 2016-01-12 11:30:02.000000000 +0100 @@ -1,6 +1,6 @@ package XML::XPath::Node::Comment; -$VERSION = '1.19'; +$VERSION = '1.21'; use strict; use warnings; use vars qw/@ISA/; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/XML-XPath-1.19/lib/XML/XPath/Node/Element.pm new/XML-XPath-1.21/lib/XML/XPath/Node/Element.pm --- old/XML-XPath-1.19/lib/XML/XPath/Node/Element.pm 2016-01-04 13:00:44.000000000 +0100 +++ new/XML-XPath-1.21/lib/XML/XPath/Node/Element.pm 2016-01-12 11:30:10.000000000 +0100 @@ -1,6 +1,6 @@ package XML::XPath::Node::Element; -$VERSION = '1.19'; +$VERSION = '1.21'; use strict; use warnings; use vars qw/@ISA/; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/XML-XPath-1.19/lib/XML/XPath/Node/Namespace.pm new/XML-XPath-1.21/lib/XML/XPath/Node/Namespace.pm --- old/XML-XPath-1.19/lib/XML/XPath/Node/Namespace.pm 2016-01-04 13:00:54.000000000 +0100 +++ new/XML-XPath-1.21/lib/XML/XPath/Node/Namespace.pm 2016-01-12 11:30:19.000000000 +0100 @@ -1,6 +1,6 @@ package XML::XPath::Node::Namespace; -$VERSION = '1.19'; +$VERSION = '1.21'; use strict; use warnings; use vars qw/@ISA/; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/XML-XPath-1.19/lib/XML/XPath/Node/PI.pm new/XML-XPath-1.21/lib/XML/XPath/Node/PI.pm --- old/XML-XPath-1.19/lib/XML/XPath/Node/PI.pm 2016-01-04 13:01:04.000000000 +0100 +++ new/XML-XPath-1.21/lib/XML/XPath/Node/PI.pm 2016-01-12 11:30:27.000000000 +0100 @@ -1,6 +1,6 @@ package XML::XPath::Node::PI; -$VERSION = '1.19'; +$VERSION = '1.21'; use strict; use warnings; use vars qw/@ISA/; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/XML-XPath-1.19/lib/XML/XPath/Node/Text.pm new/XML-XPath-1.21/lib/XML/XPath/Node/Text.pm --- old/XML-XPath-1.19/lib/XML/XPath/Node/Text.pm 2016-01-04 13:01:11.000000000 +0100 +++ new/XML-XPath-1.21/lib/XML/XPath/Node/Text.pm 2016-01-12 11:30:37.000000000 +0100 @@ -1,6 +1,6 @@ package XML::XPath::Node::Text; -$VERSION = '1.19'; +$VERSION = '1.21'; use strict; use warnings; use vars qw/@ISA/; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/XML-XPath-1.19/lib/XML/XPath/Node.pm new/XML-XPath-1.21/lib/XML/XPath/Node.pm --- old/XML-XPath-1.19/lib/XML/XPath/Node.pm 2016-01-04 12:58:58.000000000 +0100 +++ new/XML-XPath-1.21/lib/XML/XPath/Node.pm 2016-01-12 10:48:30.000000000 +0100 @@ -1,6 +1,6 @@ package XML::XPath::Node; -$VERSION = '1.19'; +$VERSION = '1.21'; use strict; use warnings; use vars qw(@ISA @EXPORT $AUTOLOAD %EXPORT_TAGS @EXPORT_OK); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/XML-XPath-1.19/lib/XML/XPath/NodeSet.pm new/XML-XPath-1.21/lib/XML/XPath/NodeSet.pm --- old/XML-XPath-1.19/lib/XML/XPath/NodeSet.pm 2016-01-04 12:59:08.000000000 +0100 +++ new/XML-XPath-1.21/lib/XML/XPath/NodeSet.pm 2016-01-12 10:48:37.000000000 +0100 @@ -1,6 +1,6 @@ package XML::XPath::NodeSet; -$VERSION = '1.19'; +$VERSION = '1.21'; use strict; use warnings; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/XML-XPath-1.19/lib/XML/XPath/Number.pm new/XML-XPath-1.21/lib/XML/XPath/Number.pm --- old/XML-XPath-1.19/lib/XML/XPath/Number.pm 2016-01-04 12:59:17.000000000 +0100 +++ new/XML-XPath-1.21/lib/XML/XPath/Number.pm 2016-01-12 10:48:45.000000000 +0100 @@ -1,6 +1,6 @@ package XML::XPath::Number; -$VERSION = '1.19'; +$VERSION = '1.21'; use XML::XPath::Boolean; use XML::XPath::Literal; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/XML-XPath-1.19/lib/XML/XPath/Parser.pm new/XML-XPath-1.21/lib/XML/XPath/Parser.pm --- old/XML-XPath-1.19/lib/XML/XPath/Parser.pm 2016-01-04 12:59:29.000000000 +0100 +++ new/XML-XPath-1.21/lib/XML/XPath/Parser.pm 2016-01-12 10:48:53.000000000 +0100 @@ -1,6 +1,6 @@ package XML::XPath::Parser; -$VERSION = '1.19'; +$VERSION = '1.21'; use strict; use warnings; use vars qw/ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/XML-XPath-1.19/lib/XML/XPath/PerlSAX.pm new/XML-XPath-1.21/lib/XML/XPath/PerlSAX.pm --- old/XML-XPath-1.19/lib/XML/XPath/PerlSAX.pm 2016-01-04 12:59:39.000000000 +0100 +++ new/XML-XPath-1.21/lib/XML/XPath/PerlSAX.pm 2016-01-12 10:49:01.000000000 +0100 @@ -1,6 +1,6 @@ package XML::XPath::PerlSAX; -$VERSION = '1.19'; +$VERSION = '1.21'; use XML::XPath::XMLParser; use strict; use warnings; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/XML-XPath-1.19/lib/XML/XPath/Root.pm new/XML-XPath-1.21/lib/XML/XPath/Root.pm --- old/XML-XPath-1.19/lib/XML/XPath/Root.pm 2016-01-04 12:59:47.000000000 +0100 +++ new/XML-XPath-1.21/lib/XML/XPath/Root.pm 2016-01-12 10:49:10.000000000 +0100 @@ -1,6 +1,6 @@ package XML::XPath::Root; -$VERSION = '1.19'; +$VERSION = '1.21'; use strict; use warnings; use XML::XPath::XMLParser; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/XML-XPath-1.19/lib/XML/XPath/Step.pm new/XML-XPath-1.21/lib/XML/XPath/Step.pm --- old/XML-XPath-1.19/lib/XML/XPath/Step.pm 2016-01-04 12:59:54.000000000 +0100 +++ new/XML-XPath-1.21/lib/XML/XPath/Step.pm 2016-01-12 10:50:06.000000000 +0100 @@ -1,6 +1,6 @@ package XML::XPath::Step; -$VERSION = '1.19'; +$VERSION = '1.21'; use XML::XPath::Parser; use XML::XPath::Node; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/XML-XPath-1.19/lib/XML/XPath/Variable.pm new/XML-XPath-1.21/lib/XML/XPath/Variable.pm --- old/XML-XPath-1.19/lib/XML/XPath/Variable.pm 2016-01-04 13:00:03.000000000 +0100 +++ new/XML-XPath-1.21/lib/XML/XPath/Variable.pm 2016-01-12 10:50:14.000000000 +0100 @@ -1,6 +1,6 @@ package XML::XPath::Variable; -$VERSION = '1.19'; +$VERSION = '1.21'; use strict; use warnings; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/XML-XPath-1.19/lib/XML/XPath/XMLParser.pm new/XML-XPath-1.21/lib/XML/XPath/XMLParser.pm --- old/XML-XPath-1.19/lib/XML/XPath/XMLParser.pm 2016-01-04 13:00:11.000000000 +0100 +++ new/XML-XPath-1.21/lib/XML/XPath/XMLParser.pm 2016-01-12 10:50:24.000000000 +0100 @@ -1,6 +1,6 @@ package XML::XPath::XMLParser; -$VERSION = '1.19'; +$VERSION = '1.21'; use strict; use warnings; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/XML-XPath-1.19/lib/XML/XPath.pm new/XML-XPath-1.21/lib/XML/XPath.pm --- old/XML-XPath-1.19/lib/XML/XPath.pm 2016-01-04 13:05:31.000000000 +0100 +++ new/XML-XPath-1.21/lib/XML/XPath.pm 2016-01-12 10:47:29.000000000 +0100 @@ -6,14 +6,14 @@ =head1 VERSION -Version 1.19 +Version 1.21 =cut use strict; use warnings; use vars qw($VERSION $AUTOLOAD $revision); -$VERSION = '1.19'; +$VERSION = '1.21'; $XML::XPath::Namespaces = 1; $XML::XPath::Debug = 0; @@ -125,7 +125,7 @@ The find function takes an XPath expression (a string) and returns either an XML::XPath::NodeSet object containing the nodes it found (or empty if no nodes matched the path), or -one of XML::XPath::Literal (a string), XML::XPath::Number or XML::XPath::Boolean. +one of L<XML::XPath::Literal> (a string), L<XML::XPath::Number> or L<XML::XPath::Boolean>. It should always return something - and you can use ->isa() to find out what it returned. If you need to check how many nodes it found you should check $nodeset->size. See L<XML::XPath::NodeSet>. An optional second parameter of a context node allows @@ -143,7 +143,7 @@ } if (!defined $context) { - # Still no context? Need to parse... + # Still no context? Need to parse. my $parser = XML::XPath::XMLParser->new( filename => $self->get_filename, xml => $self->get_xml, @@ -272,8 +272,8 @@ =head2 getNodeText($path) -Returns the L<XML::XPath::Literal> for a particular XML node. Returns a string or -'' (empty string) if the node doesn't exist. +Returns the L<XML::XPath::Literal> for a particular XML node. Returns a string if +exists or '' (empty string) if the node doesn't exist. =cut @@ -303,7 +303,7 @@ my @nodes = $nodeset->get_nodelist; if ($#nodes < 0) { - if ($node_path =~ m|/@([^/]+)$|) { + if ($node_path =~ m{/(?:@|attribute::)([^/]+)$}) { # attribute not found, so try to create it # Based upon the 'perlvar' documentation located at: @@ -346,7 +346,7 @@ =head2 createNode($path) -Creates the node matching the path given.If part of the path given, or all of the +Creates the node matching the C<$path> given. If part of the path given or all of the path do not exist, the necessary nodes will be created automatically. =cut @@ -469,12 +469,12 @@ Sets the namespace prefix mapping to the uri. -Normally in XML::XPath the prefixes in XPath node tests take their context from +Normally in C<XML::XPath> the prefixes in XPath node test take their context from the current node. This means that foo:bar will always match an element <foo:bar> regardless of the namespace that the prefix foo is mapped to (which might even change within the document, resulting in unexpected results). In order to make prefixes in XPath node tests actually map to a real URI, you need to enable that -via a call to the set_namespace method of your XML::XPath object. +via a call to the set_namespace method of your C<XML::XPath> object. =cut @@ -556,11 +556,11 @@ This module is copyright 2000 AxKit.com Ltd. This is free software, and as such comes with NO WARRANTY. No dates are used in this module. You may distribute this -module under the terms of either the Gnu GPL, or the Artistic License ( the same +module under the terms of either the Gnu GPL, or the Artistic License (the same terms as Perl itself). -For support, please subscribe to the Perl-XML mailing list at the URL -http://listserv.activestate.com/mailman/listinfo/perl-xml +For support, please subscribe to the L<Perl-XML|http://listserv.activestate.com/mailman/listinfo/perl-xml> +mailing list at the URL =cut diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/XML-XPath-1.19/t/34non_abbreviated_attrib.t new/XML-XPath-1.21/t/34non_abbreviated_attrib.t --- old/XML-XPath-1.19/t/34non_abbreviated_attrib.t 1970-01-01 01:00:00.000000000 +0100 +++ new/XML-XPath-1.21/t/34non_abbreviated_attrib.t 2016-01-07 13:19:31.000000000 +0100 @@ -0,0 +1,33 @@ +#!/usr/bin/perl + +use strict; +use warnings; +use Test::More tests => 3; + +BEGIN { use_ok 'XML::XPath' } + +my $path = XML::XPath->new(ioref => \*DATA); + +$path->createNode("/child::foo/child::bar/child::baz"); + +# +# test unabbreviated syntax +# +$path->setNodeText("/child::foo/child::bar/child::baz/attribute::id", "id1"); +my $set = $path->find("/foo/bar/baz"); +my @nodelist = $set->get_nodelist; +ok($nodelist[0]->toString =~ /id="id1"/); + +# +# test abbreviated syntax +# +$path->setNodeText("/foo/bar/baz/\@id", "id2"); +$set = $path->find("/foo/bar/baz"); +@nodelist = $set->get_nodelist; +ok($nodelist[0]->toString =~ /id="id2"/); + + +__DATA__ +<?xml version="1.0" ?> +<instanceData> +</instanceData> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/XML-XPath-1.19/t/35namespace_uri.t new/XML-XPath-1.21/t/35namespace_uri.t --- old/XML-XPath-1.19/t/35namespace_uri.t 1970-01-01 01:00:00.000000000 +0100 +++ new/XML-XPath-1.21/t/35namespace_uri.t 2016-01-09 21:51:40.000000000 +0100 @@ -0,0 +1,22 @@ +use strict; use warnings; +use Test; + +BEGIN { plan tests => 3 } + +use XML::XPath; +ok(1); + +my $xp = XML::XPath->new(ioref => *DATA); +ok($xp); + +my @nodes = $xp->findnodes("//*[namespace_uri() = 'foobar.example.com']"); +ok(@nodes, 4); + + +__DATA__ +<xml xmlns="foobar.example.com"> + <foo> + <bar/> + <foo/> + </foo> +</xml> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/XML-XPath-1.19/t/36substring.t new/XML-XPath-1.21/t/36substring.t --- old/XML-XPath-1.19/t/36substring.t 1970-01-01 01:00:00.000000000 +0100 +++ new/XML-XPath-1.21/t/36substring.t 2016-01-11 15:22:04.000000000 +0100 @@ -0,0 +1,34 @@ +use strict; +use warnings; +use Test::More tests => 12; +use XML::XPath; + +my $xp = XML::XPath->new(ioref => *DATA); +ok($xp); + +my $cases = <<'...'; +substring("12345", 2, 3) returns "234" +substring("12345", 2) returns "2345" +substring("12345", -2) returns "12345" +substring("12345", 1.5, 2.6) returns "234" +substring("12345", 0 div 0, 3) returns "" +substring("12345", 1, 0 div 0) returns "" +substring("12345", -1 div 0, 1 div 0) returns "" +substring("12345", -42, 1 div 0) returns "12345" +substring("12345", 0, 1 div 0) returns "12345" +substring("12345", 0, 3) returns "12" +substring("12345", -1, 4) returns "12" +... + +for my $case (split /\n/, $cases) { + next unless $case; + + my ($xpath, $expected) = split / returns /, $case; + $expected =~ s/"//g; + is $xp->findvalue($xpath), $expected, $case; +} + +# see http://www.w3.org/TR/1999/REC-xpath-19991116#function-substring + +__DATA__ +<foo/> \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/XML-XPath-1.19/t/37concat.t new/XML-XPath-1.21/t/37concat.t --- old/XML-XPath-1.19/t/37concat.t 1970-01-01 01:00:00.000000000 +0100 +++ new/XML-XPath-1.21/t/37concat.t 2016-01-11 15:39:01.000000000 +0100 @@ -0,0 +1,14 @@ +use strict; +use warnings; +use Test::More tests => 3; +use XML::XPath; + +my $xp = XML::XPath->new(ioref => *DATA); +ok($xp); + +my $resultset = $xp->find('concat("1","2","3"'); +ok($resultset->isa('XML::XPath::Literal')); +is($resultset, '123'); + +__DATA__ +<foo/> \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/XML-XPath-1.19/t/38starts_with.t new/XML-XPath-1.21/t/38starts_with.t --- old/XML-XPath-1.19/t/38starts_with.t 1970-01-01 01:00:00.000000000 +0100 +++ new/XML-XPath-1.21/t/38starts_with.t 2016-01-11 15:40:38.000000000 +0100 @@ -0,0 +1,18 @@ +use strict; +use warnings; +use Test::More tests => 5; +use XML::XPath; + +my $xp = XML::XPath->new(ioref => *DATA); +ok($xp); + +my $resultset = $xp->find('starts-with("123","1"'); +ok($resultset->isa('XML::XPath::Boolean')); +is($resultset->to_literal(), 'true'); + +$resultset = $xp->find('starts-with("123","23"'); +ok($resultset->isa('XML::XPath::Boolean')); +is($resultset->to_literal(), 'false'); + +__DATA__ +<foo/> \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/XML-XPath-1.19/t/39contains.t new/XML-XPath-1.21/t/39contains.t --- old/XML-XPath-1.19/t/39contains.t 1970-01-01 01:00:00.000000000 +0100 +++ new/XML-XPath-1.21/t/39contains.t 2016-01-11 15:42:01.000000000 +0100 @@ -0,0 +1,18 @@ +use strict; +use warnings; +use Test::More tests => 5; +use XML::XPath; + +my $xp = XML::XPath->new(ioref => *DATA); +ok($xp); + +my $resultset = $xp->find('contains("123","1"'); +ok($resultset->isa('XML::XPath::Boolean')); +is($resultset->to_literal(), 'true'); + +$resultset = $xp->find('contains("123","4"'); +ok($resultset->isa('XML::XPath::Boolean')); +is($resultset->to_literal(), 'false'); + +__DATA__ +<foo/> \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/XML-XPath-1.19/t/40substring_before.t new/XML-XPath-1.21/t/40substring_before.t --- old/XML-XPath-1.19/t/40substring_before.t 1970-01-01 01:00:00.000000000 +0100 +++ new/XML-XPath-1.21/t/40substring_before.t 2016-01-11 15:43:11.000000000 +0100 @@ -0,0 +1,18 @@ +use strict; +use warnings; +use Test::More tests => 5; +use XML::XPath; + +my $xp = XML::XPath->new(ioref => *DATA); +ok($xp); + +my $resultset = $xp->find('substring-before("1999/04/01","/")'); +ok($resultset->isa('XML::XPath::Literal')); +is($resultset, '1999'); + +$resultset = $xp->find('substring-before("1999/04/01","?")'); +ok($resultset->isa('XML::XPath::Literal')); +is($resultset, ''); + +__DATA__ +<foo/> \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/XML-XPath-1.19/t/41substring_after.t new/XML-XPath-1.21/t/41substring_after.t --- old/XML-XPath-1.19/t/41substring_after.t 1970-01-01 01:00:00.000000000 +0100 +++ new/XML-XPath-1.21/t/41substring_after.t 2016-01-11 16:05:26.000000000 +0100 @@ -0,0 +1,22 @@ +use strict; +use warnings; +use Test::More tests => 7; +use XML::XPath; + +my $xp = XML::XPath->new(ioref => *DATA); +ok($xp); + +my $resultset = $xp->find('substring-after("1999/04/01","/")'); +ok($resultset->isa('XML::XPath::Literal')); +is($resultset, '04/01'); + +$resultset = $xp->find('substring-after("1999/04/01","19")'); +ok($resultset->isa('XML::XPath::Literal')); +is($resultset, '99/04/01'); + +$resultset = $xp->find('substring-after("1999/04/01","2")'); +ok($resultset->isa('XML::XPath::Literal')); +is($resultset, ''); + +__DATA__ +<foo/> \ No newline at end of file
participants (1)
-
root@hilbert.suse.de