1XPath::NodeSet(3) User Contributed Perl Documentation XPath::NodeSet(3)
2
3
4
6 XML::XPath::NodeSet - a list of XML document nodes
7
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
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
24 new()
25
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
31 Returns a list of nodes. See XML::XPath::XMLParser for the format of
32 the nodes.
33
34 string_value()
35
36 Returns the string-value of the first node in the list. See the XPath
37 specification for what "string-value" means.
38
39 to_literal()
40
41 Returns the concatenation of all the string-values of all the nodes in
42 the list.
43
44 get_node($pos)
45
46 Returns the node at $pos. The node position in XPath is based at 1, not
47 0.
48
49 size()
50
51 Returns the number of nodes in the NodeSet.
52
53 pop()
54
55 Equivalent to perl's pop function.
56
57 push(@nodes)
58
59 Equivalent to perl's push function.
60
61 append($nodeset)
62
63 Given a nodeset, appends the list of nodes in $nodeset to the end of
64 the current list.
65
66 shift()
67
68 Equivalent to perl's shift function.
69
70 unshift(@nodes)
71
72 Equivalent to perl's unshift function.
73
74 prepend($nodeset)
75
76 Given a nodeset, prepends the list of nodes in $nodeset to the front of
77 the current list.
78
79
80
81perl v5.8.8 2001-06-12 XPath::NodeSet(3)