Node — Aspose.Note FOSS for Python API Reference
Lớp: Node
Enumerations: aspose.note Enumerations: from aspose.note import Node
Node là lớp cơ sở trừu tượng cho mọi phần tử trong mô hình đối tượng tài liệu OneNote. Tất cả các loại nút cụ thể (Document, Page, Outline, OutlineElement, RichText, Image, AttachedFile, v.v.) kế thừa từ Node. Bạn không bao giờ khởi tạo Node trực tiếp.
Enumerations
| Enumerations | Enumerations | Enumerations | Enumerations |
|---|---|---|---|
ParentNode | `Node | None` | Enumerations |
Document | `Document | None` | Enumerations |
Enumerations
Accept(visitor)
node.Accept(visitor: DocumentVisitor) -> NoneGửi đi phù hợp VisitXxxStart / VisitXxxEnd các phương thức trên visitor cho loại nút này. Ghi đè trong các lớp con để thực hiện double-dispatch.
Ví dụ sử dụng
Kiểm tra vị trí của bất kỳ nút nào trong cây
from aspose.note import Document, RichText
doc = Document("MyNotes.one")
for rt in doc.GetChildNodes(RichText):
# Every RichText is a Node — access parent and document via Node properties
print(f"Document : {rt.Document is doc}")
if rt.ParentNode is not None:
print(f"Parent : {type(rt.ParentNode).__name__}")
print()None-Safety
ParentNode là None chỉ cho root Document. Document là None chỉ khi một nút đã được tạo ra nhưng chưa được gắn vào cây tài liệu.
Xem Thêm
- CompositeNode: kế thừa
Nodevới quản lý con - DocumentVisitor: duyệt mẫu Visitor
- Enumerations: lớp tài liệu gốc
- Hướng dẫn nhà phát triển