HTML::DOM::NodeList - Simple node list class for HTML::DOM


NAME

HTML::DOM::NodeList - Simple node list class for HTML::DOM


SYNOPSIS

  use HTML::DOM;
  $doc = HTML::DOM->new;
  $list = $doc->body->childNodes; # returns an HTML::DOM::NodeList
    
  $list->[0];     # first node
  $list->item(0); # same
  
  $list->length; # same as scalar @$list


DESCRIPTION

This implements the NodeList interface as described in the W3C's DOM standard. In addition to the methods below, you can use a node list object as an array.

This class actually only implements those node lists that are based on array references (as returned by childNodes methods). The the HTML::DOM::NodeList::Magic manpage class is used for more complex node lists that call a code ref to update themselves. This is an implementation detail though, that you shouldn't have to worry about.


OBJECT METHODS

$list->length

Returns the number of items in the array.

$list->item($index)

Returns item number $index, numbered from 0. Note that you call also use $list->[$index] for short.


SEE ALSO

the HTML::DOM manpage

the HTML::DOM::NodeList::Magic manpage

the HTML::DOM::Node manpage

the HTML::DOM::Collection manpage