当前位置: 首页>>代码示例>>Java>>正文


Java XPathContext.getSubContextList方法代码示例

本文整理汇总了Java中com.sun.org.apache.xpath.internal.XPathContext.getSubContextList方法的典型用法代码示例。如果您正苦于以下问题:Java XPathContext.getSubContextList方法的具体用法?Java XPathContext.getSubContextList怎么用?Java XPathContext.getSubContextList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sun.org.apache.xpath.internal.XPathContext的用法示例。


在下文中一共展示了XPathContext.getSubContextList方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getCountOfContextNodeList

import com.sun.org.apache.xpath.internal.XPathContext; //导入方法依赖的package包/类
/**
 * 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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:33,代码来源:FuncLast.java

示例2: getPositionInContextNodeList

import com.sun.org.apache.xpath.internal.XPathContext; //导入方法依赖的package包/类
/**
 * Get the position in the current context node list.
 *
 * @param xctxt Runtime XPath context.
 *
 * @return The current position of the itteration in the context node list,
 *         or -1 if there is no active context node list.
 */
public int getPositionInContextNodeList(XPathContext xctxt)
{

  // System.out.println("FuncPosition- entry");
  // If we're in a predicate, then this will return non-null.
  SubContextList iter = m_isTopLevel ? null : xctxt.getSubContextList();

  if (null != iter)
  {
    int prox = iter.getProximityPosition(xctxt);

    // System.out.println("FuncPosition- prox: "+prox);
    return prox;
  }

  DTMIterator cnl = xctxt.getContextNodeList();

  if (null != cnl)
  {
    int n = cnl.getCurrentNode();
    if(n == DTM.NULL)
    {
      if(cnl.getCurrentPos() == 0)
        return 0;

      // Then I think we're in a sort.  See sort21.xsl. So the iterator has
      // already been spent, and is not on the node we're processing.
      // It's highly possible that this is an issue for other context-list
      // functions.  Shouldn't be a problem for last(), and it shouldn't be
      // a problem for current().
      try
      {
        cnl = cnl.cloneWithReset();
      }
      catch(CloneNotSupportedException cnse)
      {
        throw new com.sun.org.apache.xml.internal.utils.WrappedRuntimeException(cnse);
      }
      int currentNode = xctxt.getContextNode();
      // System.out.println("currentNode: "+currentNode);
      while(DTM.NULL != (n = cnl.nextNode()))
      {
        if(n == currentNode)
          break;
      }
    }
    // System.out.println("n: "+n);
    // System.out.println("FuncPosition- cnl.getCurrentPos(): "+cnl.getCurrentPos());
    return cnl.getCurrentPos();
  }

  // System.out.println("FuncPosition - out of guesses: -1");
  return -1;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:63,代码来源:FuncPosition.java


注:本文中的com.sun.org.apache.xpath.internal.XPathContext.getSubContextList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。