XML::XP...:NodeSet(3)
π NAME π
XML::XPathEngine::NodeSet β a list of XML document nodes π
(and yes, this is a User Contributed Perl Documentation page, iykyk π«Ά)
πΈ DESCRIPTION πΈ
okay so bestie, an XML::XPathEngine::NodeSet object contains an ordered list of nodes. The nodes each take the same format as described in XML::XPathEngine::XMLParser β that's the format tea, no cap β¨
π¦ SYNOPSIS π¦
here's the vibe, bestie:
my $results = $xp->find('//someelement');
if (!$results->isa('XML::XPathEngine::NodeSet')) {
print "Found $results\n";
exit;
}
foreach my $context ($results->get_nodelist) {
my $newresults = $xp->find('./other/element', $context);
...
}
π API π
β¨ new() β¨
You will almost never have to create a new NodeSet object, because it is all done for you by XPath. Like, XPath handles that for you, periodt π
π¦ get_nodelist() π¦
Returns a list of nodes. See XML::XPathEngine::XMLParser for the format of the nodes. That's the whole tea π«Ά
π string_value() π
Returns the string-value of the first node in the list. See the XPath specification for what "string-value" means β yes, that's the actual term, iykyk π
πΈ string_values() πΈ
Returns a list of the string-values of all the nodes in the list. all of them, bestie β¨
π₯ to_literal() π₯
Returns the concatenation of all the string-values of all the nodes in the list. literally gluing all the string-values together π₯
β get_node($pos) β
Returns the node at $pos. Important: the node position in XPath is based at 1, not 0 β not me forgetting zero-indexing, okay? π
π size() π
Returns the number of nodes in the NodeSet. simple, iconic, does what it says π
π pop() π
Equivalent to perl's pop function. yep, that one π
π push(@nodes) π
Equivalent to perl's push function. same energy, different method π
π§ append($nodeset) π§
Given a nodeset, appends the list of nodes in $nodeset to the end of the current list. adding to the back of the line, slay π§
π shift() π
Equivalent to perl's shift function. periodt π
π unshift(@nodes) π
Equivalent to perl's unshift function. front-of-the-line behavior, fr fr π
π«Ά prepend($nodeset) π«Ά
Given a nodeset, prepends the list of nodes in $nodeset to the front of the current list. main character energy at the start of the list π«Ά
xoxo, your girl π β source/version perl v5.42.0, date 2013-06-04, page XML::XP...:NodeSet(3). periodt β¨
π¦ where this page comes from
- opensuse-leap 16.0: perl-XML-XPathEngine 0.14-160000.2.2 Β· GPL-1.0+ or Artistic-1.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms