=head1 NAME

XML::Compile::Iterator - reduce view on a node tree

=head1 INHERITANCE

=head1 SYNOPSIS

=head1 DESCRIPTION

It would have been nice to be able to use XML::LibXML::Iterator, but
on the moment of this writing, that module is not maintained.  Besides,
this implementation of the iterator is more specific for our purpose.
The main user for this object currently is L<XML::Compile::Schema::Translate|XML::Compile::Schema::Translate>.

=head1 METHODS

=head2 Constructors

$obj-E<gt>B<descend>([NODE, [PATH, [FILTER]]])

=over 4

The NODE is a child of the node handled by the iterator where this
method is called upon.  Without explicit NODE, the current node is used.
Returned is a new L<XML::Compile::Iterator|XML::Compile::Iterator> object.  The new iterator
will use the same FILTER as the parent iterator by default.  The internal
administered path with be extended with the PATH.

=back

XML::Compile::Iterator-E<gt>B<new>(NODE, PATH, FILTER,)

=over 4

The NODE is a XML::LibXML::Node object, of which the direct childs
are inspected.

The FILTER a CODE reference which is called for each child node.
The only paramter is the parent NODE, and then it must return
either true or false.  In case of true, the node is selected.
The FILTERS is applied to all childs of the NODE once, when the
first child is requested by the program.

=back

=head2 Attributes

$obj-E<gt>B<filter>

=over 4

Returns the CODE reference which is used to select the nodes.

=back

$obj-E<gt>B<node>

=over 4

Returns the XML::LibXML::Node node of which the childs are walked
through.

=back

$obj-E<gt>B<path>

=over 4

The path represents the location where the node is, like a symbolic
link, how you got there.

=back

=head2 Scanning

$obj-E<gt>B<childs>

=over 4

Returns the child nodes which fulfill the filter requirements.  In LIST
context as list, in SCALAR context as reference to an ARRAY.

=back

$obj-E<gt>B<currentChild>

=over 4

Returns the current child node.

=back

$obj-E<gt>B<firstChild>

=over 4

Returns the first child node.  Does not change the current position.

=back

$obj-E<gt>B<lastChild>

=over 4

Returns the last child node which fulfills the requirements.
Does not change the current position.

=back

$obj-E<gt>B<nextChild>

=over 4

Returns the next child when available, otherwise C<undef>.

=back

$obj-E<gt>B<nrChildren>

=over 4

Returns the number of childnodes which fulfill the restriction.

=back

$obj-E<gt>B<previousChild>

=over 4

Returns the previous child when available, otherwise C<undef>.

=back

=head2 simplify XML node access

$obj-E<gt>B<currentContent>

=over 4

Returns the textContent of the L<currentChild()|XML::Compile::Iterator/"Scanning"> node, or undef.

=back

$obj-E<gt>B<currentLocal>

=over 4

Returns the local name of the L<currentChild()|XML::Compile::Iterator/"Scanning">, or the empty string.

=back

$obj-E<gt>B<currentType>

=over 4

Returns the type of the L<currentChild()|XML::Compile::Iterator/"Scanning">, or the empty string.

=back

$obj-E<gt>B<nodeLocal>

=over 4

Returns the local name of the L<node()|XML::Compile::Iterator/"Attributes">, or the empty string.

=back

$obj-E<gt>B<nodeType>

=over 4

Returns the type of the L<node()|XML::Compile::Iterator/"Attributes">, or the empty string.

=back

$obj-E<gt>B<textContent>

=over 4

Returns the textContent of the L<node()|XML::Compile::Iterator/"Attributes">, or undef.

=back

=head1 SEE ALSO

This module is part of XML-Compile distribution version 0.66,
built on January 31, 2008. Website: F<http://perl.overmeer.net/xml-compile/>

=head1 LICENSE

Copyrights 2006-2008 by Mark Overmeer. For other contributors see ChangeLog.

This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
See F<http://www.perl.com/perl/misc/Artistic.html>

