Class DTMNodeListBase

java.lang.Object
org.loboevolution.apache.xml.dtm.ref.DTMNodeListBase
All Implemented Interfaces:
NodeList
Direct Known Subclasses:
DTMChildIterNodeList, DTMNodeList

public class DTMNodeListBase extends Object implements NodeList
DTMNodeList gives us an implementation of the DOM's NodeList interface wrapped around a DTM Iterator. The author considers this something of an abominations, since NodeList was not intended to be a general purpose "list of nodes" API and is generally considered by the DOM WG to have be a mistake... but I'm told that some of the XPath/XSLT folks say they must have this solution.

Please note that this is not necessarily equivlaent to a DOM NodeList operating over the same document. In particular:

  • If there are several Text nodes in logical succession (ie, across CDATASection and EntityReference boundaries), we will return only the first; the caller is responsible for stepping through them. (%REVIEW% Provide a convenience routine here to assist, pending proposed DOM Level 3 getAdjacentText() operation?)
  • Since the whole XPath/XSLT architecture assumes that the source document is not altered while we're working with it, we do not promise to implement the DOM NodeList's "live view" response to document mutation.

State: In progress!!

  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns an iterator, allowing code to go through all key/value pairs contained in the collection.
    void
    forEach(Function function)
    Executes a provided function once per NodeList element, passing the element as an argument to the function.
    int
    Returns the number of nodes in the collection.
    item(int index)
    Returns the node with index index from the collection.
    Returns an iterator, allowing code to go through all the keys of the key/value pairs contained in the collection.
    toArray.
    Returns an iterator allowing code to go through all values (nodes) of the key/value pairs contained in the collection.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DTMNodeListBase

      public DTMNodeListBase()
  • Method Details

    • item

      public Node item(int index)
      Returns the node with index index from the collection. The nodes are sorted in tree order.
      Specified by:
      item in interface NodeList
      Parameters:
      index - a Integer object.
      Returns:
      a Node object.
    • entries

      public ES6Iterator entries()
      Description copied from interface: NodeList
      Returns an iterator, allowing code to go through all key/value pairs contained in the collection.
      Specified by:
      entries in interface NodeList
      Returns:
      a ES6Iterator object.
    • keys

      public ES6Iterator keys()
      Description copied from interface: NodeList
      Returns an iterator, allowing code to go through all the keys of the key/value pairs contained in the collection.
      Specified by:
      keys in interface NodeList
      Returns:
      a ES6Iterator object.
    • values

      public ES6Iterator values()
      Description copied from interface: NodeList
      Returns an iterator allowing code to go through all values (nodes) of the key/value pairs contained in the collection.
      Specified by:
      values in interface NodeList
      Returns:
      a ES6Iterator object.
    • forEach

      public void forEach(Function function)
      Description copied from interface: NodeList
      Executes a provided function once per NodeList element, passing the element as an argument to the function.
      Specified by:
      forEach in interface NodeList
      Parameters:
      function - a Function object.
    • toArray

      public Node[] toArray()
      Description copied from interface: NodeList

      toArray.

      Specified by:
      toArray in interface NodeList
      Returns:
      an array of Node objects.
    • getLength

      public int getLength()
      Returns the number of nodes in the collection.
      Specified by:
      getLength in interface NodeList
      Returns:
      a Integer object.