/** * Detaches the iterator from the set which it iterated over, releasing * any computational resources and placing the iterator in the INVALID * state. After<code>detach</code> has been invoked, calls to * <code>nextNode</code> or<code>previousNode</code> will raise the * exception INVALID_STATE_ERR. */ public void detach() { if(m_allowDetach && null != m_iterators){ int n = m_iterators.length; for(int i = 0; i < n; i++) { m_iterators[i].detach(); } m_iterators = null; } }
/** * Detaches the iterator from the set which it iterated over, releasing * any computational resources and placing the iterator in the INVALID * state. After<code>detach</code> has been invoked, calls to * <code>nextNode</code> or<code>previousNode</code> will raise the * exception INVALID_STATE_ERR. */ public void detach() { if(m_allowDetach && null != m_iterators){ int n = m_iterators.length; for(int i = 0; i < n; i++) { m_iterators[i].detach(); } m_iterators = null; } }
/** * @see DTMIterator#detach() */ public void detach() { if(null != m_iter) m_iter.detach(); super.detach(); }
/** * @see DTMIterator#detach() */ public void detach() { if(null != m_iter) m_iter.detach(); super.detach(); }
/** * 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; }
/** * 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; }
/** * 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 nl = m_arg0.asIterator(xctxt, xctxt.getCurrentNode()); // // We should probably make a function on the iterator for this, // // as a given implementation could optimize. // int i = 0; // // while (DTM.NULL != nl.nextNode()) // { // i++; // } // nl.detach(); DTMIterator nl = m_arg0.asIterator(xctxt, xctxt.getCurrentNode()); int i = nl.getLength(); nl.detach(); return new XNumber((double) i); } }
/** * 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 nl = m_arg0.asIterator(xctxt, xctxt.getCurrentNode()); // // We should probably make a function on the iterator for this, // // as a given implementation could optimize. // int i = 0; // // while (DTM.NULL != nl.nextNode()) // { // i++; // } // nl.detach(); DTMIterator nl = m_arg0.asIterator(xctxt, xctxt.getCurrentNode()); int i = nl.getLength(); nl.detach(); return new XNumber((double) i); } }
/** * 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); } }
/** * 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); } }
xctxt.popCurrentExpressionNode(); xctxt.popCurrentNode(); sourceNodes.detach();
xctxt.popCurrentExpressionNode(); xctxt.popCurrentNode(); sourceNodes.detach();
xctxt.popCurrentExpressionNode(); xctxt.popCurrentNode(); sourceNodes.detach();
xctxt.popCurrentExpressionNode(); xctxt.popCurrentNode(); sourceNodes.detach();