/** Reset for new run. */
  public void reset() {
    releaseDTMXRTreeFrags();
    // These couldn't be disposed of earlier (see comments in release()); zap them now.
    if (m_rtfdtm_stack != null)
      for (java.util.Enumeration e = m_rtfdtm_stack.elements(); e.hasMoreElements(); )
        m_dtmManager.release((DTM) e.nextElement(), true);

    m_rtfdtm_stack = null; // drop our references too
    m_which_rtfdtm = -1;

    if (m_global_rtfdtm != null) m_dtmManager.release(m_global_rtfdtm, true);
    m_global_rtfdtm = null;

    m_dtmManager =
        DTMManager.newInstance(
            com.sun.org.apache.xpath.internal.objects.XMLStringFactoryImpl.getFactory(),
            m_useServicesMechanism);

    m_saxLocations.removeAllElements();
    m_axesIteratorStack.removeAllElements();
    m_contextNodeLists.removeAllElements();
    m_currentExpressionNodes.removeAllElements();
    m_currentNodes.removeAllElements();
    m_iteratorRoots.RemoveAllNoClear();
    m_predicatePos.removeAllElements();
    m_predicateRoots.RemoveAllNoClear();
    m_prefixResolvers.removeAllElements();

    m_prefixResolvers.push(null);
    m_currentNodes.push(DTM.NULL);
    m_currentExpressionNodes.push(DTM.NULL);
    m_saxLocations.push(null);
  }
 private void init(boolean useServicesMechanism) {
   m_prefixResolvers.push(null);
   m_currentNodes.push(DTM.NULL);
   m_currentExpressionNodes.push(DTM.NULL);
   m_saxLocations.push(null);
   m_useServicesMechanism = useServicesMechanism;
   m_dtmManager =
       DTMManager.newInstance(
           com.sun.org.apache.xpath.internal.objects.XMLStringFactoryImpl.getFactory(),
           m_useServicesMechanism);
 }