org.apache.xpath.Expression.asIterator()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(7.7k)|赞(0)|评价(0)|浏览(136)

本文整理了Java中org.apache.xpath.Expression.asIterator()方法的一些代码示例,展示了Expression.asIterator()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Expression.asIterator()方法的具体详情如下:
包路径:org.apache.xpath.Expression
类名称:Expression
方法名:asIterator

Expression.asIterator介绍

[英]Given an select expression and a context, evaluate the XPath and return the resulting iterator.
[中]给定select表达式和上下文,计算XPath并返回结果迭代器。

代码示例

代码示例来源:origin: robovm/robovm

DTMIterator nl = m_functionExpr.asIterator(xctxt, context);
XNumber score = SCORE_NONE;

代码示例来源:origin: robovm/robovm

DTMIterator nl = m_functionExpr.asIterator(xctxt, context);
XNumber score = SCORE_NONE;

代码示例来源:origin: xalan/xalan

DTMIterator nl = m_functionExpr.asIterator(xctxt, context);
XNumber score = SCORE_NONE;

代码示例来源:origin: xalan/xalan

DTMIterator nl = m_functionExpr.asIterator(xctxt, context);
XNumber score = SCORE_NONE;

代码示例来源:origin: robovm/robovm

DTMIterator nl = m_functionExpr.asIterator(xctxt, context);
XNumber score = SCORE_NONE;

代码示例来源:origin: xalan/xalan

DTMIterator nl = m_functionExpr.asIterator(xctxt, context);
XNumber score = SCORE_NONE;

代码示例来源:origin: robovm/robovm

/**
  * 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);
 }
}

代码示例来源:origin: xalan/xalan

/**
  * 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);
 }
}

代码示例来源:origin: robovm/robovm

/**
  * 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);
 }
}

代码示例来源:origin: xalan/xalan

/**
  * 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);
 }
}

代码示例来源:origin: robovm/robovm

/**
 * Dereference the variable, and return the reference value.  Note that lazy 
 * evaluation will occur.  If a variable within scope is not found, a warning 
 * will be sent to the error listener, and an empty nodeset will be returned.
 *
 *
 * @param xctxt The runtime execution context.
 *
 * @return The evaluated variable, or an empty nodeset if not found.
 *
 * @throws javax.xml.transform.TransformerException
 */
public XObject execute(XPathContext xctxt, boolean destructiveOK) 
  throws javax.xml.transform.TransformerException
{
  XNodeSet xns = (XNodeSet)super.execute(xctxt, destructiveOK);
  DTMManager dtmMgr = xctxt.getDTMManager();
  int context = xctxt.getContextNode();
  if(dtmMgr.getDTM(xns.getRoot()).getDocument() != 
    dtmMgr.getDTM(context).getDocument())
  {
    Expression expr = (Expression)xns.getContainedIter();
    xns = (XNodeSet)expr.asIterator(xctxt, context);
  }
  return xns;
}

代码示例来源:origin: xalan/xalan

/**
 * Dereference the variable, and return the reference value.  Note that lazy 
 * evaluation will occur.  If a variable within scope is not found, a warning 
 * will be sent to the error listener, and an empty nodeset will be returned.
 *
 *
 * @param xctxt The runtime execution context.
 *
 * @return The evaluated variable, or an empty nodeset if not found.
 *
 * @throws javax.xml.transform.TransformerException
 */
public XObject execute(XPathContext xctxt, boolean destructiveOK) 
  throws javax.xml.transform.TransformerException
{
  XNodeSet xns = (XNodeSet)super.execute(xctxt, destructiveOK);
  DTMManager dtmMgr = xctxt.getDTMManager();
  int context = xctxt.getContextNode();
  if(dtmMgr.getDTM(xns.getRoot()).getDocument() != 
    dtmMgr.getDTM(context).getDocument())
  {
    Expression expr = (Expression)xns.getContainedIter();
    xns = (XNodeSet)expr.asIterator(xctxt, context);
  }
  return xns;
}

代码示例来源:origin: robovm/robovm

DTMIterator sourceNodes = m_selectExpression.asIterator(xctxt,
    sourceNode);

代码示例来源:origin: xalan/xalan

DTMIterator sourceNodes = m_selectExpression.asIterator(xctxt,
    sourceNode);

代码示例来源:origin: robovm/robovm

DTMIterator sourceNodes = m_selectExpression.asIterator(xctxt, sourceNode);
VariableStack vars = xctxt.getVarStack();
int nParams = getParamElemCount();

代码示例来源:origin: xalan/xalan

DTMIterator sourceNodes = m_selectExpression.asIterator(xctxt, sourceNode);
VariableStack vars = xctxt.getVarStack();
int nParams = getParamElemCount();

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

/**
  * 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);
 }
}

代码示例来源:origin: ibinti/bugvm

/**
  * 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);
 }
}

代码示例来源:origin: MobiVM/robovm

/**
  * 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);
 }
}

代码示例来源:origin: FlexoVM/flexovm

/**
  * 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);
 }
}

相关文章