com.sun.org.apache.xml.internal.dtm.DTMIterator Java Examples

The following examples show how to use com.sun.org.apache.xml.internal.dtm.DTMIterator. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: XNodeSet.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Construct a XNodeSet object.
 *
 * @param val Value of the XNodeSet object
 */
public XNodeSet(DTMIterator val)
{
      super();
      if(val instanceof XNodeSet)
      {
          final XNodeSet nodeSet = (XNodeSet) val;
          setIter(nodeSet.m_iter);
          m_dtmMgr = nodeSet.m_dtmMgr;
          m_last = nodeSet.m_last;
          // First make sure the DTMIterator val has a cache,
          // so if it doesn't have one, make one.
          if(!nodeSet.hasCache())
              nodeSet.setShouldCacheNodes(true);

          // Get the cache from val and use it ourselves (we share it).
          setObject(nodeSet.getIteratorCache());
      }
      else
      setIter(val);
}
 
Example #2
Source File: UnionPathIterator.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * Initialize the context values for this expression
 * after it is cloned.
 *
 * @param context The XPath runtime context for this
 * transformation.
 */
public void setRoot(int context, Object environment)
{
  super.setRoot(context, environment);

  try
  {
    if (null != m_exprs)
    {
      int n = m_exprs.length;
      DTMIterator newIters[] = new DTMIterator[n];

      for (int i = 0; i < n; i++)
      {
        DTMIterator iter = m_exprs[i].asIterator(m_execContext, context);
        newIters[i] = iter;
        iter.nextNode();
      }
      m_iterators = newIters;
    }
  }
  catch(Exception e)
  {
    throw new com.sun.org.apache.xml.internal.utils.WrappedRuntimeException(e);
  }
}
 
Example #3
Source File: UnionPathIterator.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Add an iterator to the union list.
 *
 * @param expr non-null reference to a location path iterator.
 */
public void addIterator(DTMIterator expr)
{

  // Increase array size by only 1 at a time.  Fix this
  // if it looks to be a problem.
  if (null == m_iterators)
  {
    m_iterators = new DTMIterator[1];
    m_iterators[0] = expr;
  }
  else
  {
    DTMIterator[] exprs = m_iterators;
    int len = m_iterators.length;

    m_iterators = new DTMIterator[len + 1];

    System.arraycopy(exprs, 0, m_iterators, 0, len);

    m_iterators[len] = expr;
  }
  expr.nextNode();
  if(expr instanceof Expression)
      ((Expression)expr).exprSetParent(this);
}
 
Example #4
Source File: FuncLast.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Get the position in the current context node list.
 *
 * @param xctxt non-null reference to XPath runtime context.
 *
 * @return The number of nodes in the list.
 *
 * @throws javax.xml.transform.TransformerException
 */
public int getCountOfContextNodeList(XPathContext xctxt)
        throws javax.xml.transform.TransformerException
{

  // assert(null != m_contextNodeList, "m_contextNodeList must be non-null");
  // If we're in a predicate, then this will return non-null.
  SubContextList iter = m_isTopLevel ? null : xctxt.getSubContextList();

  // System.out.println("iter: "+iter);
  if (null != iter)
    return iter.getLastPos(xctxt);

  DTMIterator cnl = xctxt.getContextNodeList();
  int count;
  if(null != cnl)
  {
    count = cnl.getLength();
    // System.out.println("count: "+count);
  }
  else
    count = 0;
  return count;
}
 
Example #5
Source File: FuncSum.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Execute the function.  The function must return
 * a valid object.
 * @param xctxt The current execution context.
 * @return A valid XObject.
 *
 * @throws javax.xml.transform.TransformerException
 */
public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException
{

  DTMIterator nodes = m_arg0.asIterator(xctxt, xctxt.getCurrentNode());
  double sum = 0.0;
  int pos;

  while (DTM.NULL != (pos = nodes.nextNode()))
  {
    DTM dtm = nodes.getDTM(pos);
    XMLString s = dtm.getStringValue(pos);

    if (null != s)
      sum += s.toDouble();
  }
  nodes.detach();

  return new XNumber(sum);
}
 
Example #6
Source File: ExsltCommon.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
/**
 * The exsl:object-type function returns a string giving the type of the object passed
 * as the argument. The possible object types are: 'string', 'number', 'boolean',
 * 'node-set', 'RTF', or 'external'.
 *
 * Most XSLT object types can be coerced to each other without error. However, there are
 * certain coercions that raise errors, most importantly treating anything other than a
 * node set as a node set. Authors of utilities such as named templates or user-defined
 * extension functions may wish to give some flexibility in the parameter and argument values
 * that are accepted by the utility; the exsl:object-type function enables them to do so.
 *
 * The Xalan extensions MethodResolver converts 'object-type' to 'objectType'.
 *
 * @param obj The object to be typed.
 * @return objectType 'string', 'number', 'boolean', 'node-set', 'RTF', or 'external'.
 *
 * @see <a href="http://www.exslt.org/">EXSLT</a>
 */
public static String objectType (Object obj)
{
  if (obj instanceof String)
    return "string";
  else if (obj instanceof Boolean)
    return "boolean";
  else if (obj instanceof Number)
    return "number";
  else if (obj instanceof DTMNodeIterator)
  {
    DTMIterator dtmI = ((DTMNodeIterator)obj).getDTMIterator();
    if (dtmI instanceof com.sun.org.apache.xpath.internal.axes.RTFIterator)
      return "RTF";
    else
      return "node-set";
  }
  else
    return "unknown";
}
 
Example #7
Source File: UnionPathIterator.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Initialize the context values for this expression
 * after it is cloned.
 *
 * @param context The XPath runtime context for this
 * transformation.
 */
public void setRoot(int context, Object environment)
{
  super.setRoot(context, environment);

  try
  {
    if (null != m_exprs)
    {
      int n = m_exprs.length;
      DTMIterator newIters[] = new DTMIterator[n];

      for (int i = 0; i < n; i++)
      {
        DTMIterator iter = m_exprs[i].asIterator(m_execContext, context);
        newIters[i] = iter;
        iter.nextNode();
      }
      m_iterators = newIters;
    }
  }
  catch(Exception e)
  {
    throw new com.sun.org.apache.xml.internal.utils.WrappedRuntimeException(e);
  }
}
 
Example #8
Source File: UnionPathIterator.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * Add an iterator to the union list.
 *
 * @param expr non-null reference to a location path iterator.
 */
public void addIterator(DTMIterator expr)
{

  // Increase array size by only 1 at a time.  Fix this
  // if it looks to be a problem.
  if (null == m_iterators)
  {
    m_iterators = new DTMIterator[1];
    m_iterators[0] = expr;
  }
  else
  {
    DTMIterator[] exprs = m_iterators;
    int len = m_iterators.length;

    m_iterators = new DTMIterator[len + 1];

    System.arraycopy(exprs, 0, m_iterators, 0, len);

    m_iterators[len] = expr;
  }
  expr.nextNode();
  if(expr instanceof Expression)
      ((Expression)expr).exprSetParent(this);
}
 
Example #9
Source File: UnionPathIterator.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/**
 * Add an iterator to the union list.
 *
 * @param expr non-null reference to a location path iterator.
 */
public void addIterator(DTMIterator expr)
{

  // Increase array size by only 1 at a time.  Fix this
  // if it looks to be a problem.
  if (null == m_iterators)
  {
    m_iterators = new DTMIterator[1];
    m_iterators[0] = expr;
  }
  else
  {
    DTMIterator[] exprs = m_iterators;
    int len = m_iterators.length;

    m_iterators = new DTMIterator[len + 1];

    System.arraycopy(exprs, 0, m_iterators, 0, len);

    m_iterators[len] = expr;
  }
  expr.nextNode();
  if(expr instanceof Expression)
      ((Expression)expr).exprSetParent(this);
}
 
Example #10
Source File: XNodeSet.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Construct a XNodeSet object.
 *
 * @param val Value of the XNodeSet object
 */
public XNodeSet(DTMIterator val)
{
      super();
      if(val instanceof XNodeSet)
      {
          final XNodeSet nodeSet = (XNodeSet) val;
          setIter(nodeSet.m_iter);
          m_dtmMgr = nodeSet.m_dtmMgr;
          m_last = nodeSet.m_last;
          // First make sure the DTMIterator val has a cache,
          // so if it doesn't have one, make one.
          if(!nodeSet.hasCache())
              nodeSet.setShouldCacheNodes(true);

          // Get the cache from val and use it ourselves (we share it).
          setObject(nodeSet.getIteratorCache());
      }
      else
      setIter(val);
}
 
Example #11
Source File: Expression.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Given an select expression and a context, evaluate the XPath
 * and return the resulting iterator, but do not clone.
 *
 * @param xctxt The execution context.
 * @param contextNode The node that "." expresses.
 *
 *
 * @return A valid DTMIterator.
 * @throws TransformerException thrown if the active ProblemListener decides
 * the error condition is severe enough to halt processing.
 *
 * @throws javax.xml.transform.TransformerException
 * @xsl.usage experimental
 */
public DTMIterator asIteratorRaw(XPathContext xctxt, int contextNode)
        throws javax.xml.transform.TransformerException
{

  try
  {
    xctxt.pushCurrentNodeAndExpression(contextNode, contextNode);

    XNodeSet nodeset = (XNodeSet)execute(xctxt);
    return nodeset.iterRaw();
  }
  finally
  {
    xctxt.popCurrentNodeAndExpression();
  }
}
 
Example #12
Source File: Expression.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
/**
 * Given an select expression and a context, evaluate the XPath
 * and return the resulting iterator.
 *
 * @param xctxt The execution context.
 * @param contextNode The node that "." expresses.
 *
 *
 * @return A valid DTMIterator.
 * @throws TransformerException thrown if the active ProblemListener decides
 * the error condition is severe enough to halt processing.
 *
 * @throws javax.xml.transform.TransformerException
 * @xsl.usage experimental
 */
public DTMIterator asIterator(XPathContext xctxt, int contextNode)
        throws javax.xml.transform.TransformerException
{

  try
  {
    xctxt.pushCurrentNodeAndExpression(contextNode, contextNode);

    return execute(xctxt).iter();
  }
  finally
  {
    xctxt.popCurrentNodeAndExpression();
  }
}
 
Example #13
Source File: XPathContext.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Get the current context node list.
 * @return An iterator for the current context list, as
 * defined in XSLT.
 */
public final DTMIterator getContextNodes()
{

  try
  {
    DTMIterator cnl = getContextNodeList();

    if (null != cnl)
      return cnl.cloneWithReset();
    else
      return null;  // for now... this might ought to be an empty iterator.
  }
  catch (CloneNotSupportedException cnse)
  {
    return null;  // error reporting?
  }
}
 
Example #14
Source File: FuncLast.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/**
 * Get the position in the current context node list.
 *
 * @param xctxt non-null reference to XPath runtime context.
 *
 * @return The number of nodes in the list.
 *
 * @throws javax.xml.transform.TransformerException
 */
public int getCountOfContextNodeList(XPathContext xctxt)
        throws javax.xml.transform.TransformerException
{

  // assert(null != m_contextNodeList, "m_contextNodeList must be non-null");
  // If we're in a predicate, then this will return non-null.
  SubContextList iter = m_isTopLevel ? null : xctxt.getSubContextList();

  // System.out.println("iter: "+iter);
  if (null != iter)
    return iter.getLastPos(xctxt);

  DTMIterator cnl = xctxt.getContextNodeList();
  int count;
  if(null != cnl)
  {
    count = cnl.getLength();
    // System.out.println("count: "+count);
  }
  else
    count = 0;
  return count;
}
 
Example #15
Source File: UnionPathIterator.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Add an iterator to the union list.
 *
 * @param expr non-null reference to a location path iterator.
 */
public void addIterator(DTMIterator expr)
{

  // Increase array size by only 1 at a time.  Fix this
  // if it looks to be a problem.
  if (null == m_iterators)
  {
    m_iterators = new DTMIterator[1];
    m_iterators[0] = expr;
  }
  else
  {
    DTMIterator[] exprs = m_iterators;
    int len = m_iterators.length;

    m_iterators = new DTMIterator[len + 1];

    System.arraycopy(exprs, 0, m_iterators, 0, len);

    m_iterators[len] = expr;
  }
  expr.nextNode();
  if(expr instanceof Expression)
      ((Expression)expr).exprSetParent(this);
}
 
Example #16
Source File: Expression.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * Given an select expression and a context, evaluate the XPath
 * and return the resulting iterator.
 *
 * @param xctxt The execution context.
 * @param contextNode The node that "." expresses.
 *
 *
 * @return A valid DTMIterator.
 * @throws TransformerException thrown if the active ProblemListener decides
 * the error condition is severe enough to halt processing.
 *
 * @throws javax.xml.transform.TransformerException
 * @xsl.usage experimental
 */
public DTMIterator asIterator(XPathContext xctxt, int contextNode)
        throws javax.xml.transform.TransformerException
{

  try
  {
    xctxt.pushCurrentNodeAndExpression(contextNode, contextNode);

    return execute(xctxt).iter();
  }
  finally
  {
    xctxt.popCurrentNodeAndExpression();
  }
}
 
Example #17
Source File: Expression.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Given an select expression and a context, evaluate the XPath
 * and return the resulting iterator.
 *
 * @param xctxt The execution context.
 * @param contextNode The node that "." expresses.
 *
 *
 * @return A valid DTMIterator.
 * @throws TransformerException thrown if the active ProblemListener decides
 * the error condition is severe enough to halt processing.
 *
 * @throws javax.xml.transform.TransformerException
 * @xsl.usage experimental
 */
public DTMIterator asIterator(XPathContext xctxt, int contextNode)
        throws javax.xml.transform.TransformerException
{

  try
  {
    xctxt.pushCurrentNodeAndExpression(contextNode, contextNode);

    return execute(xctxt).iter();
  }
  finally
  {
    xctxt.popCurrentNodeAndExpression();
  }
}
 
Example #18
Source File: NodeSequence.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Note: Not a deep clone.
 * @see DTMIterator#cloneWithReset()
 */
public DTMIterator cloneWithReset() throws CloneNotSupportedException
{
      NodeSequence seq = (NodeSequence)super.clone();
  seq.m_next = 0;
  if (m_cache != null) {
      // In making this clone of an iterator we are making
      // another NodeSequence object it has a reference
      // to the same IteratorCache object as the original
      // so we need to remember that more than one
      // NodeSequence object shares the cache.
      m_cache.increaseUseCount();
  }

  return seq;
}
 
Example #19
Source File: XPathContext.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Create a new <code>DTMIterator</code> that holds exactly one node.
 *
 * @param node The node handle that the DTMIterator will iterate to.
 *
 * @return The newly created <code>DTMIterator</code>.
 */
public DTMIterator createDTMIterator(int node)
{
  // DescendantIterator iter = new DescendantIterator();
  DTMIterator iter = new com.sun.org.apache.xpath.internal.axes.OneStepIteratorForward(Axis.SELF);
  iter.setRoot(node, this);
  return iter;
  // return m_dtmManager.createDTMIterator(node);
}
 
Example #20
Source File: FilterIterator.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public int next() {
    int node;
    while ((node = _source.next()) != END) {
        if (_filter.acceptNode(node, DTMFilter.SHOW_ALL) == DTMIterator.FILTER_ACCEPT) {
            return returnNode(node);
        }
    }
    return END;
}
 
Example #21
Source File: XRTreeFrag.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Return a java object that's closest to the representation
 * that should be handed to an extension.
 *
 * @return The object that this class wraps
 */
public Object object()
{
  if (m_DTMXRTreeFrag.getXPathContext() != null)
    return new com.sun.org.apache.xml.internal.dtm.ref.DTMNodeIterator((DTMIterator)(new com.sun.org.apache.xpath.internal.NodeSetDTM(m_dtmRoot, m_DTMXRTreeFrag.getXPathContext().getDTMManager())));
  else
    return super.object();
}
 
Example #22
Source File: LocPathIterator.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Return the first node out of the nodeset, if this expression is
 * a nodeset expression.  This is the default implementation for
 * nodesets.  Derived classes should try and override this and return a
 * value without having to do a clone operation.
 * @param xctxt The XPath runtime context.
 * @return the first node out of the nodeset, or DTM.NULL.
 */
public int asNode(XPathContext xctxt)
  throws javax.xml.transform.TransformerException
{
  DTMIterator iter = (DTMIterator)m_clones.getInstance();

  int current = xctxt.getCurrentNode();

  iter.setRoot(current, xctxt);

  int next = iter.nextNode();
  // m_clones.freeInstance(iter);
  iter.detach();
  return next;
}
 
Example #23
Source File: UnionChildIterator.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Test whether a specified node is visible in the logical view of a
 * TreeWalker or NodeIterator. This function will be called by the
 * implementation of TreeWalker and NodeIterator; it is not intended to
 * be called directly from user code.
 * @param n  The node to check to see if it passes the filter or not.
 * @return  a constant to determine whether the node is accepted,
 *   rejected, or skipped, as defined  above .
 */
public short acceptNode(int n)
{
  XPathContext xctxt = getXPathContext();
  try
  {
    xctxt.pushCurrentNode(n);
    for (int i = 0; i < m_nodeTests.length; i++)
    {
      PredicatedNodeTest pnt = m_nodeTests[i];
      XObject score = pnt.execute(xctxt, n);
      if (score != NodeTest.SCORE_NONE)
      {
        // Note that we are assuming there are no positional predicates!
        if (pnt.getPredicateCount() > 0)
        {
          if (pnt.executePredicates(n, xctxt))
            return DTMIterator.FILTER_ACCEPT;
        }
        else
          return DTMIterator.FILTER_ACCEPT;

      }
    }
  }
  catch (javax.xml.transform.TransformerException se)
  {

    // TODO: Fix this.
    throw new RuntimeException(se.getMessage());
  }
  finally
  {
    xctxt.popCurrentNode();
  }
  return DTMIterator.FILTER_SKIP;
}
 
Example #24
Source File: NodeSetDTM.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Copy NodeList members into this nodelist, adding in
 * document order.  If a node is null, don't add it.
 *
 * @param iterator DTMIterator which yields the nodes to be added.
 * @param support The XPath runtime context.
 * @throws RuntimeException thrown if this NodeSetDTM is not of
 * a mutable type.
 */
public void addNodesInDocOrder(DTMIterator iterator, XPathContext support)
{

  if (!m_mutable)
    throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_NOT_MUTABLE, null)); //"This NodeSetDTM is not mutable!");

  int node;

  while (DTM.NULL != (node = iterator.nextNode()))
  {
    addNodeInDocOrder(node, support);
  }
}
 
Example #25
Source File: DTMNodeIterator.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/** Public constructor: Wrap a DTMNodeIterator around an existing
 * and preconfigured DTMIterator
 * */
public DTMNodeIterator(DTMIterator dtmIterator)
  {
    try
    {
      dtm_iter=(DTMIterator)dtmIterator.clone();
    }
    catch(CloneNotSupportedException cnse)
    {
      throw new com.sun.org.apache.xml.internal.utils.WrappedRuntimeException(cnse);
    }
  }
 
Example #26
Source File: PredicatedNodeTest.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/**
 *  Test whether a specified node is visible in the logical view of a
 * TreeWalker or NodeIterator. This function will be called by the
 * implementation of TreeWalker and NodeIterator; it is not intended to
 * be called directly from user code.
 * @param n  The node to check to see if it passes the filter or not.
 * @return  a constant to determine whether the node is accepted,
 *   rejected, or skipped, as defined  above .
 */
public short acceptNode(int n)
{

  XPathContext xctxt = m_lpi.getXPathContext();

  try
  {
    xctxt.pushCurrentNode(n);

    XObject score = execute(xctxt, n);

    // System.out.println("\n::acceptNode - score: "+score.num()+"::");
    if (score != NodeTest.SCORE_NONE)
    {
      if (getPredicateCount() > 0)
      {
        countProximityPosition(0);

        if (!executePredicates(n, xctxt))
          return DTMIterator.FILTER_SKIP;
      }

      return DTMIterator.FILTER_ACCEPT;
    }
  }
  catch (javax.xml.transform.TransformerException se)
  {

    // TODO: Fix this.
    throw new RuntimeException(se.getMessage());
  }
  finally
  {
    xctxt.popCurrentNode();
  }

  return DTMIterator.FILTER_SKIP;
}
 
Example #27
Source File: ChildTestIterator.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 *  Get a cloned Iterator that is reset to the beginning
 *  of the query.
 *
 *  @return A cloned NodeIterator set of the start of the query.
 *
 *  @throws CloneNotSupportedException
 */
public DTMIterator cloneWithReset() throws CloneNotSupportedException
{

  ChildTestIterator clone = (ChildTestIterator) super.cloneWithReset();
  clone.m_traverser = m_traverser;

  return clone;
}
 
Example #28
Source File: Compiler.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Compile a location path.  The LocPathIterator itself may create
 * {@link com.sun.org.apache.xpath.internal.axes.AxesWalker} children.
 *
 * @param opPos The current position in the m_opMap array.
 *
 * @return reference to {@link com.sun.org.apache.xpath.internal.axes.LocPathIterator} instance.
 *
 * @throws TransformerException if a error occurs creating the Expression.
 */
public Expression locationPath(int opPos) throws TransformerException
{
  locPathDepth++;
  try
  {
    DTMIterator iter = WalkerFactory.newDTMIterator(this, opPos, (locPathDepth == 0));
    return (Expression)iter; // cast OK, I guess.
  }
  finally
  {
    locPathDepth--;
  }
}
 
Example #29
Source File: XNodeSet.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Cast result object to a nodelist.
 *
 * @return The nodeset as a nodelist
 */
public DTMIterator iter()
{
  try
  {
      if(hasCache())
              return cloneWithReset();
      else
              return this; // don't bother to clone... won't do any good!
  }
  catch (CloneNotSupportedException cnse)
  {
    throw new RuntimeException(cnse.getMessage());
  }
}
 
Example #30
Source File: DescendantIterator.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 *  Get a cloned Iterator that is reset to the beginning
 *  of the query.
 *
 *  @return A cloned NodeIterator set of the start of the query.
 *
 *  @throws CloneNotSupportedException
 */
public DTMIterator cloneWithReset() throws CloneNotSupportedException
{

  DescendantIterator clone = (DescendantIterator) super.cloneWithReset();
  clone.m_traverser = m_traverser;

  clone.resetProximityPositions();

  return clone;
}