public class NodeSet extends Object implements NodeList, org.w3c.dom.traversal.NodeIterator, Cloneable
Note that we directly implement the DOM's NodeIterator interface. We do not emulate all the behavior of the standard NodeIterator. In particular, we do not guarantee to present a "live view" of the document ... but in XSLT, the source document should never be mutated, so this should never be an issue.
Thought: Should NodeSet really implement NodeList and NodeIterator, or should there be specific subclasses of it which do so? The advantage of doing it all here is that all NodeSets will respond to the same calls; the disadvantage is that some of them may return less-than-enlightening results when you do so.
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
m_cacheNodes
True if this list is cached.
|
protected int |
m_firstFree
Number of nodes in this NodeVector.
|
protected boolean |
m_mutable
True if this list can be mutated.
|
protected int |
m_next
If this node is being used as an iterator, the next index that nextNode() will return.
|
| Constructor and Description |
|---|
NodeSet(int blocksize)
Create an empty, using the given block size.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addElement(Node value)
Append a Node onto the vector.
|
void |
addNode(Node n)
Add a node to the NodeSet.
|
Object |
clone() |
void |
detach() |
Node |
elementAt(int i)
Get the nth element.
|
boolean |
getExpandEntityReferences() |
org.w3c.dom.traversal.NodeFilter |
getFilter() |
int |
getLength() |
Node |
getRoot() |
int |
getWhatToShow() |
Node |
item(int index) |
Node |
nextNode() |
Node |
previousNode() |
void |
runTo(int index) |
int |
size() |
protected transient int m_next
protected final transient boolean m_mutable
protected final transient boolean m_cacheNodes
protected int m_firstFree
public NodeSet(int blocksize)
blocksize - Size of blocks to allocatepublic Node getRoot()
getRoot in interface org.w3c.dom.traversal.NodeIteratorpublic int getWhatToShow()
getWhatToShow in interface org.w3c.dom.traversal.NodeIteratorpublic org.w3c.dom.traversal.NodeFilter getFilter()
getFilter in interface org.w3c.dom.traversal.NodeIteratorpublic boolean getExpandEntityReferences()
getExpandEntityReferences in interface org.w3c.dom.traversal.NodeIteratorpublic Node nextNode() throws DOMException
nextNode in interface org.w3c.dom.traversal.NodeIteratorDOMExceptionpublic Node previousNode() throws DOMException
previousNode in interface org.w3c.dom.traversal.NodeIteratorDOMExceptionpublic void detach()
detach in interface org.w3c.dom.traversal.NodeIteratorpublic void runTo(int index)
public void addNode(Node n)
n - Node to be addedRuntimeException - thrown if this NodeSet is not of a mutable type.public Object clone() throws CloneNotSupportedException
clone in class ObjectCloneNotSupportedExceptionpublic int size()
public void addElement(Node value)
value - Node to add to the vectorpublic Node elementAt(int i)
i - Index of node to getCopyright © 2022. All rights reserved.