Perl Diver 2.31
Main Environment Variables Perl Default Values Perl Config - Summary Perl Config - Full Installed Modules List Directory uptime Docs

Module Documentation
Details and documentation about a specific module, including version and documentation (if available). Note that while links to perldoc.com and search.cpan.org are provided, the module may be part of a larger distribution. If you reach a File Not Found page on either site, please try the parent module.

XML::LibXML::NodeList

Name XML::LibXML::NodeList
Version 2.0132
Located at /usr/lib64/perl5/vendor_perl
File /usr/lib64/perl5/vendor_perl/XML/LibXML/NodeList.pm
Is Core No
Search CPAN for this module XML::LibXML::NodeList
Documentation XML::LibXML::NodeList
Module Details XML::LibXML::NodeList

NAME

XML::LibXML::NodeList - a list of XML document nodes


DESCRIPTION

An XML::LibXML::NodeList object contains an ordered list of nodes, as detailed by the W3C DOM documentation of Node Lists.


SYNOPSIS

  my $results = $dom->findnodes('//somepath');
  foreach my $context ($results->get_nodelist) {
    my $newresults = $context->findnodes('./other/element');
    ...
  }


API

new(@nodes)

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

get_nodelist()

Returns a list of nodes, the contents of the node list, as a perl list.

string_value()

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

to_literal()

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

to_literal_delimited($separator)

Returns the concatenation of all the string-values of all the nodes in the list, delimited by the specified separator.

to_literal_list()

Returns all the string-values of all the nodes in the list as a perl list.

get_node($pos)

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

size()

Returns the number of nodes in the NodeList.

pop()

Equivalent to perl's pop function.

push(@nodes)

Equivalent to perl's push function.

append($nodelist)

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

shift()

Equivalent to perl's shift function.

unshift(@nodes)

Equivalent to perl's unshift function.

prepend($nodelist)

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

map($coderef)

Equivalent to perl's map function.

grep($coderef)

Equivalent to perl's grep function.

sort($coderef)

Equivalent to perl's sort function.

Caveat: Perl's magic $a and $b variables are not available in $coderef. Instead the two terms are passed to the coderef as arguments.

reverse()

Equivalent to perl's reverse function.

foreach($coderef)

Inspired by perl's foreach loop. Executes the coderef on each item in the list. Similar to map, but instead of returning the list of values returned by $coderef, returns the original NodeList.

reduce($coderef, $init)

Equivalent to List::Util's reduce function. $init is optional and provides an initial value for the reduction.

Caveat: Perl's magic $a and $b variables are not available in $coderef. Instead the two terms are passed to the coderef as arguments.

Perl Diver brought to you by ScriptSolutions.com © 1997- 2024