TreeWalker
TreeWalker
概述
TreeWalker 是 Aspose.Html FOSS 中用于 Python 的类。
光标式 DOM 遍历,限制在根子树内。
此类提供 8 个方法,用于在 Python 程序中处理 TreeWalker 对象。可用的方法包括:__init__、first_child、last_child、next_node、next_sibling、parent_node、previous_node、previous_sibling。在安装 Aspose.Html FOSS for Python 包后,所有公共成员对任何 Python 应用程序均可访问。属性:current_node、filter、root、what_to_show。
属性
| 名称 | 类型 | 访问 | 描述 |
|---|---|---|---|
root | "Node" | 读取 | 此遍历器子树的根节点。 |
what_to_show | int | 读取 | 在构造时传入的 what_to_show 位掩码。 |
filter | `“Callable[[Node], int] | None”` | 读取 |
current_node | "Node" | 读写 | 遍历器当前所在的节点。 |
方法
| 签名 | 描述 |
|---|---|
| `init(root: “Node”, what_to_show: int, node_filter: “Callable[[Node], int] | None”)` |
parent_node() → `“Node | None”` |
first_child() → `“Node | None”` |
last_child() → `“Node | None”` |
previous_sibling() → `“Node | None”` |
next_sibling() → `“Node | None”` |
next_node() → `“Node | None”` |
previous_node() → `“Node | None”` |