|
ASPOSE home |
java.lang.Objectcom.aspose.words.NodeList
public class NodeList
NodeList is returned by NodeList supports indexed access and iteration.Note: Treat the NodeList collection as a "snapshot" collection. NodeList starts
as a "live" collection because the nodes are not actually retrieved when the XPath query is run.
The nodes are only retrieved upon access and at this time the node and all nodes that precede
it are cached forming a "snapshot" collection.
Property Getters/Setters Summary | ||
---|---|---|
int | getCount() | |
Gets the number of nodes in the list. | ||
Node | get(int index) | |
Retrieves a node at the given index. |
Method Summary | ||
---|---|---|
java.util.Iterator | iterator() | |
Provides a simple "foreach" style iteration over the collection of nodes. | ||
Aspose.Words.Node[] | toArray() | |
Copies all nodes from the collection to a new array of nodes. |
Property Getters/Setters Detail |
---|
getCount | |
public int getCount() |
get | |
public Node get(int index) |
The index is zero-based.
Negative indexes are allowed and indicate access from the back of the collection. For example -1 means the last item, -2 means the second before last and so on.
If index is greater than or equal to the number of items in the list, this returns a null reference.
If index is negative and its absolute value is greater than the number of items in the list, this returns a null reference.
index
- An index into the list of nodes.Method Detail |
---|
iterator | |
public java.util.Iterator iterator() |
toArray | |
public Aspose.Words.Node[] toArray() |
You should not be adding/removing nodes while iterating over a collection of nodes because it invalidates the iterator and requires refreshes for live collections.
To be able to add/remove nodes during iteration, use this method to copy nodes into a fixed-size array and then iterate over the array.
|
ASPOSE home |