예제 #1
0
 /**
  * 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);
 }
예제 #2
0
  /**
   * 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?
    }
  }
예제 #3
0
  /**
   * 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);
    }
  }
예제 #4
0
  /**
   * 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);
  }