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_showint读取在构造时传入的 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() → `“NodeNone”`
first_child() → `“NodeNone”`
last_child() → `“NodeNone”`
previous_sibling() → `“NodeNone”`
next_sibling() → `“NodeNone”`
next_node() → `“NodeNone”`
previous_node() → `“NodeNone”`

另请参阅

 中文