Node — Aspose.Note FOSS for Python API Reference
Class: Node
Package: aspose.note
Import: from aspose.note import Node
Node is the abstract base class for every element in the OneNote document object model. All concrete node types (Document, Page, Outline, OutlineElement, RichText, Image, AttachedFile, etc.) inherit from Node. You never instantiate Node directly.
Properties
| Property | Type | Access | Description |
|---|---|---|---|
ParentNode | Node | None | Read | The parent node in the document tree. None for the root Document node. |
Document | Document | None | Read | Walks up the ancestor chain and returns the root Document. Returns None if this node is not yet attached to a document. |
NodeType | NodeType | Read | Identifies the concrete node type as a NodeType enum value. |
Methods
Accept(visitor)
node.Accept(visitor: DocumentVisitor) -> NoneDispatches the appropriate VisitXxxStart / VisitXxxEnd methods on the visitor for this node type. Override in subclasses to implement double-dispatch.
NodeType Values
Node.NodeType returns one of the following NodeType enum values:
| Value | Description |
|---|---|
NodeType.Document | Root document node |
NodeType.Page | OneNote page |
NodeType.Outline | Positional outline container |
NodeType.OutlineElement | Leaf content container |
NodeType.RichText | Styled text block |
NodeType.Image | Embedded image |
NodeType.Table | Table |
NodeType.AttachedFile | Embedded file attachment |
Usage Example
Inspect any node’s position in the tree
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"NodeType : {rt.NodeType}")
print(f"Document : {rt.Document is doc}")
if rt.ParentNode is not None:
print(f"Parent : {rt.ParentNode.NodeType}")
print()None-Safety
ParentNode is None only for the root Document. Document is None only when a node has been created but not yet attached to a document tree.
See Also
- CompositeNode: extends
Nodewith child management - DocumentVisitor: visitor pattern traversal
- Document: root document class
- Developer Guide