Class NodeSet

  • All Implemented Interfaces:
    org.w3c.dom.NodeList

    public class NodeSet
    extends java.lang.Object
    implements org.w3c.dom.NodeList
    The NodeSet class can act as either a NodeVector, NodeList, or NodeIterator. However, in order for it to act as a NodeVector or NodeList, it's required that setShouldCacheNodes(true) be called before the first nextNode() is called, in order that nodes can be added as they are fetched. Derived classes that implement iterators must override runTo(int index), in order that they may run the iteration to the given index.

    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.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.ArrayList<org.w3c.dom.Node> nodes  
    • Constructor Summary

      Constructors 
      Constructor Description
      NodeSet​(java.util.List<org.w3c.dom.Node> nodes)
      Create an empty, using the given block size.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getLength()
      org.w3c.dom.Node item​(int index)
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • nodes

        private final java.util.ArrayList<org.w3c.dom.Node> nodes
    • Constructor Detail

      • NodeSet

        public NodeSet​(java.util.List<org.w3c.dom.Node> nodes)
        Create an empty, using the given block size.
    • Method Detail

      • item

        public org.w3c.dom.Node item​(int index)
        Specified by:
        item in interface org.w3c.dom.NodeList
      • getLength

        public int getLength()
        Specified by:
        getLength in interface org.w3c.dom.NodeList