1XML::XPath::NodeSet(3)User Contributed Perl DocumentationXML::XPath::NodeSet(3)
2
3
4

NAME

6       XML::XPath::NodeSet - a list of XML document nodes
7

DESCRIPTION

9       An XML::XPath::NodeSet object contains an ordered list of nodes. The
10       nodes each take the same format as described in XML::XPath::XMLParser.
11

SYNOPSIS

13               my $results = $xp->find('//someelement');
14               if (!$results->isa('XML::XPath::NodeSet')) {
15                       print "Found $results\n";
16                       exit;
17               }
18               foreach my $context ($results->get_nodelist) {
19                       my $newresults = $xp->find('./other/element', $context);
20                       ...
21               }
22

API

24   new()
25       You will almost never have to create a new NodeSet object, as it is all
26       done for you by XPath.
27
28   get_nodelist()
29       Returns a list of nodes. See XML::XPath::XMLParser for the format of
30       the nodes.
31
32   string_value()
33       Returns the string-value of the first node in the list.  See the XPath
34       specification for what "string-value" means.
35
36   to_literal()
37       Returns the concatenation of all the string-values of all the nodes in
38       the list.
39
40   get_node($pos)
41       Returns the node at $pos. The node position in XPath is based at 1, not
42       0.
43
44   size()
45       Returns the number of nodes in the NodeSet.
46
47   pop()
48       Equivalent to perl's pop function.
49
50   push(@nodes)
51       Equivalent to perl's push function.
52
53   append($nodeset)
54       Given a nodeset, appends the list of nodes in $nodeset to the end of
55       the current list.
56
57   shift()
58       Equivalent to perl's shift function.
59
60   unshift(@nodes)
61       Equivalent to perl's unshift function.
62
63   prepend($nodeset)
64       Given a nodeset, prepends the list of nodes in $nodeset to the front of
65       the current list.
66
67
68
69perl v5.34.0                      2022-01-21            XML::XPath::NodeSet(3)
Impressum