NodeIsComposite Property
Returns true if this node can contain other nodes.

Namespace: Aspose.Words
Assembly: Aspose.Words (in Aspose.Words.dll) Version: 19.12
public virtual bool IsComposite { get; }

Property Value

Type: Boolean
This method returns false as Node cannot have child nodes.
Shows how to efficiently visit all direct and indirect children of a composite node.
public void RecurseAllNodes()
    // Open a document.
    Document doc = new Document(MyDir + "Node.RecurseAllNodes.doc");

    // Invoke the recursive function that will walk the tree.

/// <summary>
/// A simple function that will walk through all children of a specified node recursively 
/// and print the type of each node to the screen.
/// </summary>
public void TraverseAllNodes(CompositeNode parentNode)
    // This is the most efficient way to loop through immediate children of a node.
    for (Node childNode = parentNode.FirstChild; childNode != null; childNode = childNode.NextSibling)
        // Do some useful work.

        // Recurse into the node if it is a composite node.
        if (childNode.IsComposite)
            TraverseAllNodes((CompositeNode) childNode);
See Also