TreeWalker
TreeWalker
نمای کلی
TreeWalker یک کلاس در Aspose.Html FOSS برای Python است.
پیمایش DOM به سبک مکاننما که به یک زیردرخت ریشه محدود شده است.
این کلاس ۸ متد برای کار با اشیاء TreeWalker در برنامههای Python فراهم میکند. متدهای موجود شامل: __init__, first_child, last_child, next_node, next_sibling, parent_node, previous_node, previous_sibling هستند. تمام اعضای عمومی پس از نصب بسته Aspose.Html FOSS برای Python برای هر برنامه Python در دسترس هستند. خصوصیات: current_node, filter, root, what_to_show.
خواص
| نام | نوع | دسترسی | توضیح |
|---|---|---|---|
root | "Node" | خواندن | گره ریشهٔ این زیردرخت walker. |
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”` |