XML-XPath-1.42/ 0000755 0001750 0001750 00000000000 13137314727 012466 5 ustar manwar manwar XML-XPath-1.42/t/ 0000755 0001750 0001750 00000000000 13137314727 012731 5 ustar manwar manwar XML-XPath-1.42/t/50xmlxpathparsercache.t 0000644 0001750 0001750 00000002432 13136402365 017325 0 ustar manwar manwar #!/bin/perl -w
use XML::XPath;
use Test::More;
# Some example XML. Note that the items are identical except for the
# namespaces ('namespace1' vs 'namespace2').
my $xml1 = <<'EOXML';
foo
bar
EOXML
my $xml2 = <<'EOXML';
foo
bar
EOXML
# This will work as expected, but will also populate the cache
# with the parser for $xpath1.
my $xpath1 = XML::XPath->new( xml => $xml1 );
$xpath1->set_namespace( "a", "namespace0" );
$xpath1->set_namespace( "b", "namespace1" );
my @nodes = $xpath1->findnodes( "/a:first/b:second/b:second-item" );
is(scalar(@nodes), 2);
my $xpath2 = XML::XPath->new( xml => $xml2 );
$xpath2->set_namespace( "a", "namespace0" );
$xpath2->set_namespace( "b", "namespace2" );
@nodes = $xpath2->findnodes( "/a:first/b:second/b:second-item" );
is(scalar(@nodes), 2);
done_testing();
XML-XPath-1.42/t/32duplicate_nodes.t 0000644 0001750 0001750 00000001100 13136402365 016410 0 ustar manwar manwar #!/usr/bin/perl
use strict;
use warnings;
use XML::XPath;
use Test::More;
my $xml='';
my %results= ( '/root/daughter/..' => 'root[root_att]',);
plan tests => scalar keys %results;
my $xpath = XML::XPath->new( xml => $xml);
foreach my $path ( keys %results) {
my @xpath_result = $xpath->findnodes( $path);
is( dump_nodes( @xpath_result) => $results{$path}, "path: $path");
}
sub dump_nodes {
return join '-', map { $_->getName . "[" . $_->getAttribute( 'att') . "]" } @_
}
XML-XPath-1.42/t/38starts_with.t 0000644 0001750 0001750 00000000626 13136402365 015643 0 ustar manwar manwar 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__