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

EnumerationsEnumerationsEnumerationsEnumerations
ParentNode`NodeNone`Enumerations
Document`DocumentNone`Enumerations

Enumerations

Accept(visitor)

node.Accept(visitor: DocumentVisitor) -> None

Gử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

ParentNodeNone chỉ cho root Document. DocumentNone 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

 Tiếng Việt