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: 17.6
Syntax
public abstract class CompositeNode : Node, 
	IEnumerable, IXPathNavigable

public abstract class CompositeNode : Node, 
	IEnumerable, IXPathNavigable

The CompositeNode type exposes the following members.

Constructors
  NameDescription
Protected methodCompositeNode
Initializes a new instance of the CompositeNode class
Protected methodCompositeNode(DocumentBase)
Initializes a new instance of the CompositeNode class
Top
Properties
  NameDescription
Public propertyCode exampleChildNodes
Gets all immediate child nodes of this node.
Public propertyCount
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.)
Top
Methods
  NameDescription
Public methodCode exampleAccept
Accepts a visitor.
(Inherited from Node.)
Protected methodAcceptChildren
Protected methodAcceptCore
Public methodCode exampleAppendChild
Adds the specified node to the end of the list of child nodes for this node.
Public methodCode exampleClone
Creates a duplicate of the node.
(Inherited from Node.)
Protected methodCoreRemoveSelfOnly
Public methodCreateNavigator
Reserved for system use. IXPathNavigable.
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetAncestor(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(NodeType, Boolean)
Returns a live collection of child nodes that match the specified type.
Public methodGetChildNodes(NodeType, Boolean, Boolean) Obsolete.
Returns a 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
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodCode exampleGetText
Gets the text of this node and of all its children.
(Overrides NodeGetText.)
Public methodGetType
Gets the type of the current instance.
(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 methodInsertBefore
Inserts the specified node immediately before the specified reference node.
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
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 methodPreviousPreOrder
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
Returns a string that represents the current object.
(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.)
Public methodToTxt Obsolete.
Exports the content of the node into a string in plain text format.
(Inherited from Node.)
Top
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.
[C#]

Paragraph paragraph = (Paragraph)doc.GetChild(NodeType.Paragraph, 0, true);
[Visual Basic]

Dim paragraph As Paragraph = CType(doc.GetChild(NodeType.Paragraph, 0, True), Paragraph)
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