}
  public int nextNode()  {//    // If the cache is on, and the node has already been found, then //    // just return from the list.//    if ((null != m_cachedNodes)//            && (m_cachedNodes.getCurrentPos() < m_cachedNodes.size()))//    {//      return m_cachedNodes.nextNode();//    }    // If the cache is on, and the node has already been found, then     // just return from the list.    if ((null != m_cachedNodes)            && (m_next < m_cachedNodes.size()))    {      int next = m_cachedNodes.elementAt(m_next);          m_next++;      m_currentContextNode = next;      return next;    }    if (m_foundLast)      return DTM.NULL;    // Loop through the iterators getting the current fetched     // node, and get the earliest occuring in document order    int earliestNode = DTM.NULL;    if (null != m_iterators)    {      int n = m_iterators.length;      int iteratorUsed = -1;      for (int i = 0; i < n; i++)      {        int node = m_iterators[i].getCurrentNode();        if (DTM.NULL == node)          continue;        else if (DTM.NULL == earliestNode)        {          iteratorUsed = i;          earliestNode = node;        }        else        {          if (node == earliestNode)          {            // Found a duplicate, so skip past it.            m_iterators[i].nextNode();          }          else          {            DTM dtm = getDTM(node);            if (dtm.isNodeAfter(node, earliestNode))            {              iteratorUsed = i;              earliestNode = node;            }          }        }      }      if (DTM.NULL != earliestNode)      {        m_iterators[iteratorUsed].nextNode();        if (null != m_cachedNodes)          m_cachedNodes.addElement(earliestNode);        m_next++;      }      else        m_foundLast = true;    }    m_lastFetched = earliestNode;    return earliestNode;  }