{
    "mode": "perldoc",
    "parameter": "XML::LibXML::NodeList",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/XML%3A%3ALibXML%3A%3ANodeList/json",
    "generated": "2026-06-10T13:42:53Z",
    "synopsis": "my $results = $dom->findnodes('//somepath');\nforeach my $context ($results->getnodelist) {\nmy $newresults = $context->findnodes('./other/element');\n...\n}",
    "sections": {
        "NAME": {
            "content": "XML::LibXML::NodeList - a list of XML document nodes\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "An XML::LibXML::NodeList object contains an ordered list of nodes, as detailed by the W3C DOM\ndocumentation of Node Lists.\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "my $results = $dom->findnodes('//somepath');\nforeach my $context ($results->getnodelist) {\nmy $newresults = $context->findnodes('./other/element');\n...\n}\n",
            "subsections": []
        },
        "API": {
            "content": "new(@nodes)\nYou will almost never have to create a new NodeList object, as it is all done for you by XPath.\n\ngetnodelist()\nReturns a list of nodes, the contents of the node list, as a perl list.\n\nstringvalue()\nReturns the string-value of the first node in the list. See the XPath specification for what\n\"string-value\" means.\n\ntoliteral()\nReturns the concatenation of all the string-values of all the nodes in the list.\n\ntoliteraldelimited($separator)\nReturns the concatenation of all the string-values of all the nodes in the list, delimited by\nthe specified separator.\n\ntoliterallist()\nReturns all the string-values of all the nodes in the list as a perl list.\n\ngetnode($pos)\nReturns the node at $pos. The node position in XPath is based at 1, not 0.\n\nsize()\nReturns the number of nodes in the NodeList.\n\npop()\nEquivalent to perl's pop function.\n\npush(@nodes)\nEquivalent to perl's push function.\n\nappend($nodelist)\nGiven a nodelist, appends the list of nodes in $nodelist to the end of the current list.\n\nshift()\nEquivalent to perl's shift function.\n\nunshift(@nodes)\nEquivalent to perl's unshift function.\n\nprepend($nodelist)\nGiven a nodelist, prepends the list of nodes in $nodelist to the front of the current list.\n\nmap($coderef)\nEquivalent to perl's map function.\n\ngrep($coderef)\nEquivalent to perl's grep function.\n\nsort($coderef)\nEquivalent to perl's sort function.\n\nCaveat: Perl's magic $a and $b variables are not available in $coderef. Instead the two terms\nare passed to the coderef as arguments.\n\nreverse()\nEquivalent to perl's reverse function.\n\nforeach($coderef)\nInspired by perl's foreach loop. Executes the coderef on each item in the list. Similar to\n\"map\", but instead of returning the list of values returned by $coderef, returns the original\nNodeList.\n\nreduce($coderef, $init)\nEquivalent to List::Util's reduce function. $init is optional and provides an initial value for\nthe reduction.\n\nCaveat: Perl's magic $a and $b variables are not available in $coderef. Instead the two terms\nare passed to the coderef as arguments.\n",
            "subsections": []
        }
    },
    "summary": "XML::LibXML::NodeList - a list of XML document nodes",
    "flags": [],
    "examples": [],
    "see_also": []
}