1Tree::XPathEngine::NodeUSseetr(3C)ontributed Perl DocumeTnrteaet:i:oXnPathEngine::NodeSet(3)
2
3
4

NAME

6       Tree::XPathEngine::NodeSet - a list of XML document nodes
7

DESCRIPTION

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

SYNOPSIS

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

API

25   new()
26       You will almost never have to create a new NodeSet object, as it is all
27       done for you by XPath.
28
29   get_nodelist()
30       Returns a list of nodes. See Tree::XPathEngine::XMLParser for the
31       format of the nodes.
32
33   xpath_string_value()
34       Returns the string-value of the first node in the list.  See the XPath
35       specification for what "string-value" means.
36
37   xpath_to_literal()
38       Returns the concatenation of all the string-values of all the nodes in
39       the list.
40
41   get_node($pos)
42       Returns the node at $pos. The node position in XPath is based at 1, not
43       0.
44
45   size()
46       Returns the number of nodes in the NodeSet.
47
48   pop()
49       Equivalent to perl's pop function.
50
51   push(@nodes)
52       Equivalent to perl's push function.
53
54   append($nodeset)
55       Given a nodeset, appends the list of nodes in $nodeset to the end of
56       the current list.
57
58   shift()
59       Equivalent to perl's shift function.
60
61   unshift(@nodes)
62       Equivalent to perl's unshift function.
63
64   prepend($nodeset)
65       Given a nodeset, prepends the list of nodes in $nodeset to the front of
66       the current list.
67
68   xpath_get_root_node
69       Returns the root node of the first node in the set
70
71   sort
72       Returns a sorted nodeset using the "cmp" method on nodes
73
74   remove_duplicates
75       Returns a sorted nodeset of unique nodes. The input nodeset MUST be
76       sorted
77
78   xpath_to_boolean
79       Returns true if the nodeset is not empty
80
81   xpath_to_number
82       Returns the concatenation of all the string-values of all the nodes in
83       the list as a Tree::XPathEngine::Number object;
84
85
86
87perl v5.32.0                      2020-07-28     Tree::XPathEngine::NodeSet(3)
Impressum