source: gs2-extensions/parallel-building/trunk/src/perllib/cpan/XML/XPath/Root.pm@ 24626

Last change on this file since 24626 was 24626, checked in by jmt12, 13 years ago

An (almost) complete copy of the perllib directory from a (circa SEP2011) head checkout from Greenstone 2 trunk - in order to try and make merging in this extension a little easier later on (as there have been some major changes to buildcol.pl commited in the main trunk but not in the x64 branch)

File size: 643 bytes
Line 
1# $Id: Root.pm 7909 2004-08-06 05:11:55Z mdewsnip $
2
3package XML::XPath::Root;
4use strict;
5use XML::XPath::XMLParser;
6use XML::XPath::NodeSet;
7
8sub new {
9 my $class = shift;
10 my $self; # actually don't need anything here - just a placeholder
11 bless \$self, $class;
12}
13
14sub as_string {
15 # do nothing
16}
17
18sub as_xml {
19 return "<Root/>\n";
20}
21
22sub evaluate {
23 my $self = shift;
24 my $nodeset = shift;
25
26# warn "Eval ROOT\n";
27
28 # must only ever occur on 1 node
29 die "Can't go to root on > 1 node!" unless $nodeset->size == 1;
30
31 my $newset = XML::XPath::NodeSet->new();
32 $newset->push($nodeset->get_node(1)->getRootNode());
33 return $newset;
34}
35
361;
Note: See TracBrowser for help on using the repository browser.