diff options
Diffstat (limited to 't/14axisancestor.t')
-rw-r--r-- | t/14axisancestor.t | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/t/14axisancestor.t b/t/14axisancestor.t new file mode 100644 index 0000000..c10e5b5 --- /dev/null +++ b/t/14axisancestor.t @@ -0,0 +1,22 @@ +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('/AAA/BBB/DDD/CCC/EEE/ancestor::*'); +ok(@nodes, 4); +ok($nodes[1]->getName, "BBB"); # test document order + +@nodes = $xp->findnodes('//FFF/ancestor::*'); +ok(@nodes, 5); + +__DATA__ +<AAA> +<BBB><DDD><CCC><DDD/><EEE/></CCC></DDD></BBB> +<CCC><DDD><EEE><DDD><FFF/></DDD></EEE></DDD></CCC> +</AAA> |