NodeIterator

Overview

NodeIterator is a class in Aspose.Html FOSS for Python.

Flat, stateful iteration over DOM nodes matching a filter.

This class provides 4 methods for working with NodeIterator objects in Python programs. Available methods include: __init__, detach, next_node, previous_node. All public members are accessible to any Python application after installing the Aspose.Html FOSS for Python package. Properties: filter, pointer_before_reference_node, reference_node, root, what_to_show.

Properties

NameTypeAccessDescription
root"Node"ReadThe root node of this iterator’s subtree.
what_to_showintReadThe what_to_show bitmask passed at construction.
filter"Callable[[Node], int] | None"ReadThe user-supplied filter callable, or None.
reference_node"Node"ReadThe current reference node of this iterator.
pointer_before_reference_nodeboolReadTrue if the iterator position is before the reference node.

Methods

SignatureDescription
__init__(root: "Node", what_to_show: int, node_filter: "Callable[[Node], int] | None")Initialise a NodeIterator.
next_node()"Node | None"Advance the iterator and return the next accepted node.
previous_node()"Node | None"Retreat the iterator and return the previous accepted node.
detach()No-op — kept for API compatibility.

See Also