summaryrefslogtreecommitdiff
path: root/t/08name.t
blob: 15eb7fb2dcac2e450fb37a2914a6e2ce660c21f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
use Test;
BEGIN { plan tests => 5 }

use XML::XPath;
ok(1);

my $xp = XML::XPath->new(ioref => *DATA);
ok($xp);

my @nodes;
@nodes = $xp->findnodes('//*[name() = "BBB"]');
ok(@nodes, 5);

@nodes = $xp->findnodes('//*[starts-with(name(), "B")]');
ok(@nodes, 7);

@nodes = $xp->findnodes('//*[contains(name(), "C")]');
ok(@nodes, 3);

__DATA__
<AAA>
<BCC><BBB/><BBB/><BBB/></BCC>
<DDB><BBB/><BBB/></DDB>
<BEC><CCC/><DBD/></BEC>
</AAA>