|
java.lang.Object
Node
com.aspose.words.CompositeNode
- All Implemented Interfaces:
- java.lang.Iterable, java.lang.Iterable, java.lang.Cloneable
- Direct Known Subclasses:
- Cell, Document, InlineStory, Paragraph, Row, Section, ShapeBase, Story, Table
public abstract class CompositeNode - extends Node
Base class for nodes that can contain other nodes.
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.
|
Method Summary |
abstract boolean | accept(DocumentVisitor visitor) | → inherited from Node |
|
Accepts a visitor.
|
Node | appendChild(Node newChild) | |
|
Adds the specified node to the end of the list of child nodes for this node.
|
Node | deepClone(boolean isCloneChildren) | |
|
Creates a duplicate of the node.
|
Node | getAncestor(int ancestorType) | → inherited from Node |
|
Gets the first ancestor of the specified NodeType.
|
Node | getAncestor(java.lang.Class ancestorType) | → inherited from Node |
|
Gets the first ancestor of the specified object type.
|
Node | getChild(int nodeType, int index, boolean isDeep) | |
|
Returns an Nth child node that matches the specified type.
|
NodeCollection | getChildNodes(int nodeType, boolean isDeep) | |
|
Returns a live collection of child nodes that match the specified type.
|
NodeCollection | getChildNodes(int nodeType, boolean isDeep, boolean isLive) | |
|
Returns a "live" or "snapshot" collection of child node that match the specified type.
|
java.lang.String | getText() | |
|
Gets the text of this node and of all its children.
|
int | indexOf(Node child) | |
|
Returns the index of the specified child node in the child node array.
|
Node | insertAfter(Node newChild, Node refChild) | |
|
Inserts the specified node immediately after the specified reference node.
|
Node | insertBefore(Node newChild, Node refChild) | |
|
Inserts the specified node immediately before the specified reference node.
|
java.util.Iterator | iterator() | |
|
Provides support for the for each style iteration over the child nodes of this node.
|
Node | nextPreOrder(Node rootNode) | → inherited from Node |
|
Gets next node according to the pre-order tree traversal algorithm.
|
Node | prependChild(Node newChild) | |
|
Adds the specified node to the beginning of the list of child nodes for this node.
|
Node | previousPreOrder(Node rootNode) | → inherited from Node |
|
Gets the previous node according to the pre-order tree traversal algorithm.
|
void | remove() | → inherited from Node |
|
Removes itself from the parent.
|
void | removeAllChildren() | |
|
Removes all the child nodes of the current node.
|
Node | removeChild(Node oldChild) | |
|
Removes the specified child node.
|
NodeList | selectNodes(java.lang.String xpath) | |
|
Selects a list of nodes matching the XPath expression.
|
Node | selectSingleNode(java.lang.String xpath) | |
|
Selects the first Node that matches the XPath expression.
|
java.lang.String | toTxt() | → inherited from Node |
|
Exports the content of the node into a string in plain text format.
|
|
Property Getters/Setters Detail |
isComposite | |
public boolean isComposite()
|
-
Returns true as this node can have child nodes.
hasChildNodes | |
public boolean hasChildNodes()
|
-
Returns true if this node has any child nodes.
-
Gets all immediate child nodes of this node.
Note, ChildNodes is equivalent to calling GetChildNodes(NodeType.Any, false)
and creates and returns a new collection every time it is accessed. If there are no child nodes, this property returns an empty collection. Example: Shows how to enumerate immediate children of a CompositeNode using the enumerator provided by the ChildNodes collection.
for (int i = 0; i < paragraph.getChildNodes().getCount(); i++)
{
Node childNode = paragraph.getChildNodes().get(i);
// Paragraph may contain children of various types such as runs, inline shapes and so on.
if (childNode.getNodeType() == NodeType.RUN)
{
|