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


Java NodeSetDTM类代码示例

本文整理汇总了Java中org.apache.xpath.NodeSetDTM的典型用法代码示例。如果您正苦于以下问题:Java NodeSetDTM类的具体用法?Java NodeSetDTM怎么用?Java NodeSetDTM使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: appendBtoFList

import org.apache.xpath.NodeSetDTM; //导入依赖的package包/类
/**
 * Add a list of counted nodes that were built in backwards document
 * order, or a list of counted nodes that are in forwards document
 * order.
 *
 * @param flist Vector of nodes built in forwards document order
 * @param blist Vector of nodes built in backwards document order
 */
void appendBtoFList(NodeSetDTM flist, NodeSetDTM blist)
{

  int n = blist.size();

  for (int i = (n - 1); i >= 0; i--)
  {
    flist.addElement(blist.item(i));
  }
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:19,代码来源:CountersTable.java

示例2: XNodeSetForDOM

import org.apache.xpath.NodeSetDTM; //导入依赖的package包/类
public XNodeSetForDOM(Node node, DTMManager dtmMgr)
{
  m_dtmMgr = dtmMgr;
  m_origObj = node;
  int dtmHandle = dtmMgr.getDTMHandleFromNode(node);
  setObject(new NodeSetDTM(dtmMgr));
  ((NodeSetDTM) m_obj).addNode(dtmHandle);
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:9,代码来源:XNodeSetForDOM.java

示例3: mutableNodeset

import org.apache.xpath.NodeSetDTM; //导入依赖的package包/类
/**
 * Cast result object to a nodelist. Always issues an error.
 *
 * @return The object as a NodeSetDTM.
 *
 * @throws javax.xml.transform.TransformerException
 */
public NodeSetDTM mutableNodeset()
        throws javax.xml.transform.TransformerException
{

  error(XPATHErrorResources.ER_CANT_CONVERT_TO_MUTABLENODELIST,
        new Object[]{ getTypeString() });  //"Can not convert "+getTypeString()+" to a NodeSetDTM!");

  return (NodeSetDTM) m_obj;
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:17,代码来源:XObject.java

示例4: XNodeSet

import org.apache.xpath.NodeSetDTM; //导入依赖的package包/类
/**
 * Construct a XNodeSet object for one node.
 *
 * @param n Node to add to the new XNodeSet object
 */
public XNodeSet(int n, DTMManager dtmMgr)
{

  super(new NodeSetDTM(dtmMgr));
  m_dtmMgr = dtmMgr;

  if (DTM.NULL != n)
  {
    ((NodeSetDTM) m_obj).addNode(n);
    m_last = 1;
  }
  else
  	m_last = 0;
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:20,代码来源:XNodeSet.java

示例5: getLength

import org.apache.xpath.NodeSetDTM; //导入依赖的package包/类
/**
 * @see DTMIterator#getLength()
 */
public int getLength()
{
  IteratorCache cache = getCache();
  
	if(cache != null)
	{
      // Nodes from the iterator are cached
      if (cache.isComplete()) {
          // All of the nodes from the iterator are cached
          // so just return the number of nodes in the cache
          NodeVector nv = cache.getVector();
          return nv.size();
      }
      
      // If this NodeSequence wraps a mutable nodeset, then
      // m_last will not reflect the size of the nodeset if
      // it has been mutated...
      if (m_iter instanceof NodeSetDTM)
      {
          return m_iter.getLength();
      }    
      
 	if(-1 == m_last)
 	{
 		int pos = m_next;
 		runTo(-1);
 		m_next = pos;
 	}
   return m_last;
	}
	else
	{
		return (-1 == m_last) ? (m_last = m_iter.getLength()) : m_last;
	}
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:39,代码来源:NodeSequence.java

示例6: execute

import org.apache.xpath.NodeSetDTM; //导入依赖的package包/类
/**
 * The here function returns a node-set containing the attribute or
 * processing instruction node or the parent element of the text node
 * that directly bears the XPath expression.  This expression results
 * in an error if the containing XPath expression does not appear in the
 * same XML document against which the XPath expression is being evaluated.
 *
 * @param xctxt
 * @return the xobject
 * @throws javax.xml.transform.TransformerException
 */
public XObject execute(XPathContext xctxt) throws TransformerException {

    Node xpathOwnerNode = (Node) xctxt.getOwnerObject();

    if (xpathOwnerNode == null) {
        return null;
    }

    int xpathOwnerNodeDTM = xctxt.getDTMHandleFromNode(xpathOwnerNode);

    int currentNode = xctxt.getCurrentNode();
    DTM dtm = xctxt.getDTM(currentNode);
    int docContext = dtm.getDocument();

    if (DTM.NULL == docContext) {
        error(xctxt, XPATHErrorResources.ER_CONTEXT_HAS_NO_OWNERDOC, null);
    }

    {
        // check whether currentNode and the node containing the XPath expression
        // are in the same document
        Document currentDoc =
            XMLUtils.getOwnerDocument(dtm.getNode(currentNode));
        Document xpathOwnerDoc = XMLUtils.getOwnerDocument(xpathOwnerNode);

        if (currentDoc != xpathOwnerDoc) {
            throw new TransformerException(I18n.translate("xpath.funcHere.documentsDiffer"));
        }
    }

    XNodeSet nodes = new XNodeSet(xctxt.getDTMManager());
    NodeSetDTM nodeSet = nodes.mutableNodeset();

    {
        int hereNode = DTM.NULL;

        switch (dtm.getNodeType(xpathOwnerNodeDTM)) {

        case Node.ATTRIBUTE_NODE :
        case Node.PROCESSING_INSTRUCTION_NODE : {
            // returns a node-set containing the attribute /  processing instruction node
            hereNode = xpathOwnerNodeDTM;

            nodeSet.addNode(hereNode);

            break;
        }
        case Node.TEXT_NODE : {
            // returns a node-set containing the parent element of the
            // text node that directly bears the XPath expression
            hereNode = dtm.getParent(xpathOwnerNodeDTM);

            nodeSet.addNode(hereNode);

            break;
        }
        default :
            break;
        }
    }

    /** $todo$ Do I have to do this detach() call? */
    nodeSet.detach();

    return nodes;
}
 
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:78,代码来源:FuncHere.java

示例7: getMatchingAncestors

import org.apache.xpath.NodeSetDTM; //导入依赖的package包/类
/**
 * Get the ancestors, up to the root, that match the
 * pattern.
 * 
 * @param xctxt The XPath runtime state for this.
 * @param node Count this node and it's ancestors.
 * @param stopAtFirstFound Flag indicating to stop after the
 * first node is found (difference between level = single
 * or multiple)
 * @return The number of ancestors that match the pattern.
 *
 * @throws javax.xml.transform.TransformerException
 */
NodeVector getMatchingAncestors(
        XPathContext xctxt, int node, boolean stopAtFirstFound)
          throws javax.xml.transform.TransformerException
{

  NodeSetDTM ancestors = new NodeSetDTM(xctxt.getDTMManager());
  XPath countMatchPattern = getCountMatchPattern(xctxt, node);
  DTM dtm = xctxt.getDTM(node);

  while (DTM.NULL != node)
  {
    if ((null != m_fromMatchPattern)
            && (m_fromMatchPattern.getMatchScore(xctxt, node)
                != XPath.MATCH_SCORE_NONE))
    {

      // The following if statement gives level="single" different 
      // behavior from level="multiple", which seems incorrect according 
      // to the XSLT spec.  For now we are leaving this in to replicate 
      // the same behavior in XT, but, for all intents and purposes we 
      // think this is a bug, or there is something about level="single" 
      // that we still don't understand.
      if (!stopAtFirstFound)
        break;
    }

    if (null == countMatchPattern)
      System.out.println(
        "Programmers error! countMatchPattern should never be null!");

    if (countMatchPattern.getMatchScore(xctxt, node)
            != XPath.MATCH_SCORE_NONE)
    {
      ancestors.addElement(node);

      if (stopAtFirstFound)
        break;
    }

    node = dtm.getParent(node);
  }

  return ancestors;
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:58,代码来源:ElemNumber.java

示例8: Counter

import org.apache.xpath.NodeSetDTM; //导入依赖的package包/类
/**
 * Construct a counter object.
 *
 * @param numberElem The owning xsl:number element. 
 * @param countNodes A vector of all nodes counted so far.
 *
 * @throws TransformerException
 */
Counter(ElemNumber numberElem, NodeSetDTM countNodes) throws TransformerException
{
  m_countNodes = countNodes;
  m_numberElem = numberElem;
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:14,代码来源:Counter.java


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