Subject: | nextNode and previousNode fail when filter returns FILTER_REJECT |
I have recently been trying to use XML::LibXML::Iterator with
XML::NodeFilter. I have found a bug in the implementation of the
nextNode() and previousNode() subroutines which basically makes this
impossible to achieve. When the NodeFilter accept_node() method returns
FILTER_REJECT the while(1) ends up in an infinite loop.
The problem is that the iterator function works with the node stored in
$self->{CURRENT} (and also refers to $self->{INDEX}). When a value of
FILTER_REJECT is returned neither the current node or the index are
updated before the next call to the iterator. This results in the
iterator code forever returning the same "next" node.