167 lines
3.7 KiB
HTML
167 lines
3.7 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of XML::XPathEngine::NodeSet</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>XML::XPathEngine::NodeSet</H1>
|
|
Section: User Contributed Perl Documentation (3pm)<BR>Updated: 2018-01-01<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
XML::XPathEngine::NodeSet - a list of XML document nodes
|
|
<A NAME="lbAC"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
|
|
|
|
An XML::XPathEngine::NodeSet object contains an ordered list of nodes. The nodes
|
|
each take the same format as described in XML::XPathEngine::XMLParser.
|
|
<A NAME="lbAD"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
|
|
|
|
|
|
|
|
<PRE>
|
|
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);
|
|
...
|
|
}
|
|
|
|
</PRE>
|
|
|
|
|
|
<A NAME="lbAE"> </A>
|
|
<H2>API</H2>
|
|
|
|
|
|
|
|
<A NAME="lbAF"> </A>
|
|
<H3><I>new()</I></H3>
|
|
|
|
|
|
|
|
You will almost never have to create a new NodeSet object, as it is all
|
|
done for you by XPath.
|
|
<A NAME="lbAG"> </A>
|
|
<H3><I>get_nodelist()</I></H3>
|
|
|
|
|
|
|
|
Returns a list of nodes. See XML::XPathEngine::XMLParser for the format of
|
|
the nodes.
|
|
<A NAME="lbAH"> </A>
|
|
<H3><I>string_value()</I></H3>
|
|
|
|
|
|
|
|
Returns the string-value of the first node in the list.
|
|
See the XPath specification for what ``string-value'' means.
|
|
<A NAME="lbAI"> </A>
|
|
<H3><I>string_values()</I></H3>
|
|
|
|
|
|
|
|
Returns a list of the string-values of all the nodes in the list.
|
|
<A NAME="lbAJ"> </A>
|
|
<H3><I>to_literal()</I></H3>
|
|
|
|
|
|
|
|
Returns the concatenation of all the string-values of all
|
|
the nodes in the list.
|
|
<A NAME="lbAK"> </A>
|
|
<H3>get_node($pos)</H3>
|
|
|
|
|
|
|
|
Returns the node at <TT>$pos</TT>. The node position in XPath is based at 1, not 0.
|
|
<A NAME="lbAL"> </A>
|
|
<H3><I>size()</I></H3>
|
|
|
|
|
|
|
|
Returns the number of nodes in the NodeSet.
|
|
<A NAME="lbAM"> </A>
|
|
<H3><I>pop()</I></H3>
|
|
|
|
|
|
|
|
Equivalent to perl's pop function.
|
|
<A NAME="lbAN"> </A>
|
|
<H3>push(@nodes)</H3>
|
|
|
|
|
|
|
|
Equivalent to perl's push function.
|
|
<A NAME="lbAO"> </A>
|
|
<H3>append($nodeset)</H3>
|
|
|
|
|
|
|
|
Given a nodeset, appends the list of nodes in <TT>$nodeset</TT> to the end of the
|
|
current list.
|
|
<A NAME="lbAP"> </A>
|
|
<H3><I>shift()</I></H3>
|
|
|
|
|
|
|
|
Equivalent to perl's shift function.
|
|
<A NAME="lbAQ"> </A>
|
|
<H3>unshift(@nodes)</H3>
|
|
|
|
|
|
|
|
Equivalent to perl's unshift function.
|
|
<A NAME="lbAR"> </A>
|
|
<H3>prepend($nodeset)</H3>
|
|
|
|
|
|
|
|
Given a nodeset, prepends the list of nodes in <TT>$nodeset</TT> to the front of
|
|
the current list.
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="1"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="2"><A HREF="#lbAC">DESCRIPTION</A><DD>
|
|
<DT id="3"><A HREF="#lbAD">SYNOPSIS</A><DD>
|
|
<DT id="4"><A HREF="#lbAE">API</A><DD>
|
|
<DL>
|
|
<DT id="5"><A HREF="#lbAF"><I>new()</I></A><DD>
|
|
<DT id="6"><A HREF="#lbAG"><I>get_nodelist()</I></A><DD>
|
|
<DT id="7"><A HREF="#lbAH"><I>string_value()</I></A><DD>
|
|
<DT id="8"><A HREF="#lbAI"><I>string_values()</I></A><DD>
|
|
<DT id="9"><A HREF="#lbAJ"><I>to_literal()</I></A><DD>
|
|
<DT id="10"><A HREF="#lbAK">get_node($pos)</A><DD>
|
|
<DT id="11"><A HREF="#lbAL"><I>size()</I></A><DD>
|
|
<DT id="12"><A HREF="#lbAM"><I>pop()</I></A><DD>
|
|
<DT id="13"><A HREF="#lbAN">push(@nodes)</A><DD>
|
|
<DT id="14"><A HREF="#lbAO">append($nodeset)</A><DD>
|
|
<DT id="15"><A HREF="#lbAP"><I>shift()</I></A><DD>
|
|
<DT id="16"><A HREF="#lbAQ">unshift(@nodes)</A><DD>
|
|
<DT id="17"><A HREF="#lbAR">prepend($nodeset)</A><DD>
|
|
</DL>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:06:01 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|