CompositeNode Class

Base class for nodes that can contain other nodes.
Inheritance Hierarchy
SystemObject
  Aspose.WordsNode
    Aspose.WordsCompositeNode
      More...

Namespace:  Aspose.Words
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.3
Syntax
public abstract class CompositeNode : Node, 
	IEnumerable<Node>, IEnumerable, IXPathNavigable

The CompositeNode type exposes the following members.

Properties
  NameDescription
Public propertyCode exampleChildNodes
Gets all immediate child nodes of this node.
Public propertyCode exampleCount
Gets the number of immediate children of this node.
Public propertyCode exampleDocument
Gets the document to which this node belongs.
(Inherited from Node.)
Public propertyCode exampleFirstChild
Gets the first child of the node.
Public propertyCode exampleHasChildNodes
Returns true if this node has any child nodes.
Public propertyCode exampleIsComposite
Returns true as this node can have child nodes.
(Overrides NodeIsComposite.)
Public propertyCode exampleLastChild
Gets the last child of the node.
Public propertyCode exampleNextSibling
Gets the node immediately following this node.
(Inherited from Node.)
Public propertyCode exampleNodeType
Gets the type of this node.
(Inherited from Node.)
Public propertyCode exampleParentNode
Gets the immediate parent of this node.
(Inherited from Node.)
Public propertyCode examplePreviousSibling
Gets the node immediately preceding this node.
(Inherited from Node.)
Public propertyCode exampleRange
Returns a Range object that represents the portion of a document that is contained in this node.
(Inherited from Node.)
Methods
  NameDescription
Public methodCode exampleAccept
Accepts a visitor.
(Inherited from Node.)
Public methodCode exampleAppendChild
Adds the specified node to the end of the list of child nodes for this node.
Public methodCode exampleClone (Inherited from Node.)
Public methodEquals (Inherited from Object.)
Public methodCode exampleGetAncestor(Type)
Gets the first ancestor of the specified object type.
(Inherited from Node.)
Public methodCode exampleGetAncestor(NodeType)
Gets the first ancestor of the specified NodeType.
(Inherited from Node.)
Public methodCode exampleGetChild
Returns an Nth child node that matches the specified type.
Public methodCode exampleGetChildNodes
Returns a live collection of child nodes that match the specified type.
Public methodCode exampleGetEnumerator
Provides support for the for each style iteration over the child nodes of this node.
Public methodGetHashCode (Inherited from Object.)
Public methodCode exampleGetText
Gets the text of this node and of all its children.
(Overrides NodeGetText.)
Public methodGetType (Inherited from Object.)
Public methodCode exampleIndexOf
Returns the index of the specified child node in the child node array.
Public methodCode exampleInsertAfter
Inserts the specified node immediately after the specified reference node.
Public methodCode exampleInsertBefore
Inserts the specified node immediately before the specified reference node.
Public methodCode exampleNextPreOrder
Gets next node according to the pre-order tree traversal algorithm.
(Inherited from Node.)
Public methodCode examplePrependChild
Adds the specified node to the beginning of the list of child nodes for this node.
Public methodCode examplePreviousPreOrder
Gets the previous node according to the pre-order tree traversal algorithm.
(Inherited from Node.)
Public methodCode exampleRemove
Removes itself from the parent.
(Inherited from Node.)
Public methodCode exampleRemoveAllChildren
Removes all the child nodes of the current node.
Public methodCode exampleRemoveChild
Removes the specified child node.
Public methodCode exampleRemoveSmartTags
Removes all SmartTag descendant nodes of the current node.
Public methodCode exampleSelectNodes
Selects a list of nodes matching the XPath expression.
Public methodCode exampleSelectSingleNode
Selects the first Node that matches the XPath expression.
Public methodToString (Inherited from Object.)
Public methodCode exampleToString(SaveFormat)
Exports the content of the node into a string in the specified format.
(Inherited from Node.)
Public methodCode exampleToString(SaveOptions)
Exports the content of the node into a string using the specified save options.
(Inherited from Node.)
Remarks

A document is represented as a tree of nodes, similar to DOM or XmlDocument.

For more info see the Composite design pattern.

The CompositeNode class:

  • Provides access to the child nodes.
  • Implements Composite operations such as insert and remove children.
  • Provides methods for XPath navigation.
Examples
Shows how to extract a specific child node from a CompositeNode by using the GetChild method and passing the NodeType and index.
Paragraph paragraph = (Paragraph) doc.GetChild(NodeType.Paragraph, 0, true);
See Also
Inheritance Hierarchy
SystemObject
  Aspose.WordsNode
    Aspose.WordsCompositeNode
      Aspose.Words.BuildingBlocksBuildingBlock
      Aspose.WordsDocumentBase
      Aspose.Words.DrawingShapeBase
      Aspose.WordsInlineStory
      Aspose.Words.MarkupSmartTag
      Aspose.Words.MarkupStructuredDocumentTag
      Aspose.Words.MathOfficeMath
      Aspose.WordsParagraph
      Aspose.WordsSection
      Aspose.WordsStory
      Aspose.Words.TablesCell
      Aspose.Words.TablesRow
      Aspose.Words.TablesTable