HTML::Object::XPath::NodeSet - HTML Object XPath Node Set
use HTML::Object::XPath::NodeSet; my $set = HTML::Object::XPath::NodeSet->new || die( HTML::Object::XPath::NodeSet->error, "\n" ); my $results = $xp->find( '//someelement' ); if( !$results->isa( 'HTML::Object::XPath::NodeSet' ) ) { print( "Found $results\n" ); exit; } foreach my $context ( $results->get_nodelist ) { my $newresults = $xp->find( './other/element', $context ); # ... }
v0.2.0
This module contains an ordered list of nodes. The nodes each take the same format as described in HTML::Object::XPath.
You should never have to create a new NodeSet object, as it is all done for you by HTML::Object::XPath.
Given a nodeset, this appends the list of nodes in nodeset to the end of the current list.
nodeset
Provided with an integer representing a position and this returns the node at position.
position
The node position in XPath is based at 1, not 0.
Returns a list of nodes. See HTML::Object::XPath for the format of the nodes.
Returns a list of all elements' own child nodes by calling getChildNodes on each one of them.
getChildNodes
Returns a list of all elements' own id by calling getElementById on each one of them.
getElementById
Returns the first element's value of getRootNode
getRootNode
Returns a new HTML::Object::XPath::Literal object, passing it whatever arguments was provided.
Returns a new HTML::Object::XPath::Number object, passing it whatever arguments was provided.
Equivalent to perl's "pop" in perlfunc function. This removes the last element from our stack and returns it.
Given a nodeset, prepends the list of nodes in nodeset to the front of the current list.
Provided with a list of nodes and this will add them to the stack in this object.
Equivalent to perl's "push" in perlfunc function.
This removes any duplicates there might be in our internal list of elements.
This method reverse the order of the elements in our internal list of elements.
Equivalent to perl's "shift" in perlfunc function.
Returns the number of nodes in the HTML::Object::XPath::NodeSet.
This method sorts all the elements by comparing them to one another using cmp
cmp
Returns the string-value of the first node in the list.
See the HTML::Object::XPath specification for what "string-value" means.
Returns a list of the string-values of all the nodes in the list.
Returns true if there are elements in our internal array of elements, or false otherwise.
Returns a string resulting from the concatenation of each elements' string value.
Returns the concatenation of all the string-values of all the nodes in the list.
Returns a new number object from the value returned from "to_literal"
Provided with a list of nodes and this will add them at the top of the stack in this object.
Equivalent to perl's "unshift" in perlfunc function.
Jacques Deguest <jack@deguest.jp>
HTML::Object::XPath, HTML::Object::XPath::Boolean, HTML::Object::XPath::Expr, HTML::Object::XPath::Function, HTML::Object::XPath::Literal, HTML::Object::XPath::LocationPath, HTML::Object::XPath::NodeSet, HTML::Object::XPath::Number, HTML::Object::XPath::Root, HTML::Object::XPath::Step, HTML::Object::XPath::Variable
Copyright(c) 2021 DEGUEST Pte. Ltd.
All rights reserved
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install HTML::Object, copy and paste the appropriate command in to your terminal.
cpanm
cpanm HTML::Object
CPAN shell
perl -MCPAN -e shell install HTML::Object
For more information on module installation, please visit the detailed CPAN module installation guide.