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
| Name | Type | Access | Description |
|---|---|---|---|
root | "Node" | Read | The root node of this iterator’s subtree. |
what_to_show | int | Read | The what_to_show bitmask passed at construction. |
filter | "Callable[[Node], int] | None" | Read | The user-supplied filter callable, or None. |
reference_node | "Node" | Read | The current reference node of this iterator. |
pointer_before_reference_node | bool | Read | True if the iterator position is before the reference node. |
Methods
| Signature | Description |
|---|---|
__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. |