DOKK / manpages / debian 12 / libtree-xpathengine-perl / Tree::XPathEngine::NodeSet.3pm.en
Tree::XPathEngine::NodeSet(3pm) User Contributed Perl Documentation Tree::XPathEngine::NodeSet(3pm)

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

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

        my $results = $xp->find('//someelement');
        if (!$results->isa('Tree::XPathEngine::NodeSet')) {
                print "Found $results\n";
                exit;
        }
        foreach my $context ($results->get_nodelist) {
                my $newresults = $xp->find('./other/element', $context);
                ...
        }

new()

You will almost never have to create a new NodeSet object, as it is all done for you by XPath.

get_nodelist()

Returns a list of nodes. See Tree::XPathEngine::XMLParser for the format of the nodes.

xpath_string_value()

Returns the string-value of the first node in the list. See the XPath specification for what "string-value" means.

xpath_to_literal()

Returns the concatenation of all the string-values of all the nodes in the list.

Returns the node at $pos. The node position in XPath is based at 1, not 0.

size()

Returns the number of nodes in the NodeSet.

pop()

Equivalent to perl's pop function.

Equivalent to perl's push function.

Given a nodeset, appends the list of nodes in $nodeset to the end of the current list.

shift()

Equivalent to perl's shift function.

Equivalent to perl's unshift function.

Given a nodeset, prepends the list of nodes in $nodeset to the front of the current list.

Returns the root node of the first node in the set

Returns a sorted nodeset using the "cmp" method on nodes

Returns a sorted nodeset of unique nodes. The input nodeset MUST be sorted

Returns true if the nodeset is not empty

Returns the concatenation of all the string-values of all the nodes in the list as a Tree::XPathEngine::Number object;

2022-11-20 perl v5.36.0