---
Product: Aspose.Note
Platform: python
Page Type: reference
Canonical URL: https://reference.aspose.org/note/python/compositenode
---

# CompositeNode

## Overview

`CompositeNode` is a class in Aspose.Note FOSS for Python.
Inherits from: `Node`.

CompositeNode.AppendChildLast appends the given node as the last child and returns the added node.

This class declares 10 methods for CompositeNode objects in Python programs.
Available methods include: `Accept`, `AppendChildFirst`, `AppendChildLast`, `GetChildNodes`, `GetEnumerator`, `InsertChild`, `RemoveChild`, `__iter__`, `__new__`, `__post_init__`.
Public members are accessible to any Python application after installing the Aspose.Note FOSS for Python package.
Properties: `Document`, `FirstChild`, `LastChild`, `ParentNode`.

## Properties

| Name | Type | Access | Description |
|------|------|--------|-------------|
| `FirstChild` | `Node \| None` | Read | Gets the first child. |
| `LastChild` | `Node \| None` | Read | Gets the last child. |
| `ParentNode` | `Node \| None` | Read | Gets the parent node. |
| `Document` | `Document \| None` | Read | Gets the document. |

## Methods

| Signature | Description |
|-----------|-------------|
| `__new__()` | Calls __new__ on this CompositeNode instance. |
| `AppendChildLast(node: TNode)` → `TNode` | ` adds the given child node to the end of the collection, returns the added node of type `TNode`, and updates the parent‑child relationships |
| `AppendChildFirst(node: TNode)` → `TNode` | Inserts the given node as the first child and returns the added node |
| `InsertChild(index: int, node: TNode)` → `TNode` | Inserts the given node at the specified index among children and returns the added node |
| `RemoveChild(node: Node)` | Removes the specified child node from this composite node |
| `GetEnumerator()` → `Iterator[Node]` | Returns an iterator over the child nodes of this composite node |
| `__iter__()` → `Iterator[Node]` | Calls __iter__ on this CompositeNode instance. |
| `GetChildNodes(node_type: type[TNode])` → `list[TNode]` | Returns a list of child nodes that match the provided node type |
| `__post_init__()` | Calls __post_init__ on this CompositeNode instance. |
| `Accept(visitor: DocumentVisitor)` | Calls Accept(visitor) on this CompositeNode instance. |

## See Also

- [Aspose.Note — Enterprise API Reference](https://reference.aspose.com/note/)