get_child_nodes method

get_child_nodes(node_type, is_deep)

Returns a live collection of child nodes that match the specified types.

def get_child_nodes(self, node_type: aspose.words.NodeType, is_deep: bool):
    ...
ParameterTypeDescription
node_typeNodeType
is_deepbool

Examples

Shows how to get child nodes of StructuredDocumentTagRangeStart.

doc = aw.Document(MY_DIR + "Multi-section structured document tags.docx")
tag = doc.get_child_nodes(aw.NodeType.STRUCTURED_DOCUMENT_TAG_RANGE_START, True)[0].as_structured_document_tag_range_start()

print("StructuredDocumentTagRangeStart values:")
print(f"\t|Child nodes count: {tag.get_child_nodes(aw.NodeType.ANY, False).count}\n")

for node in tag.get_child_nodes(aw.NodeType.ANY, False):
    print(f"\t|Child node type: {node.node_type}")

for node in tag.get_child_nodes(aw.NodeType.RUN, True):
    print(f"\t|Child node text: {node.get_text()}")

See Also