Package org.apache.xpath.axes

Examples of org.apache.xpath.axes.LocPathIterator


 
  Expression expr1 = firstOccuranceOwner.getExpression();
  if(DEBUG)
    assertIsLocPathIterator(expr1, firstOccuranceOwner);
  boolean isGlobal = (paths == m_absPaths);
  LocPathIterator lpi = (LocPathIterator)expr1;
  int stepCount = countSteps(lpi);
  for(int j = start; j < n; j++)
  {
    ExpressionOwner owner2 = (ExpressionOwner)paths.elementAt(j);
    if(null != owner2)
    {
      Expression expr2 = owner2.getExpression();
      boolean isEqual = expr2.deepEquals(lpi);
      if(isEqual)
      {     
        LocPathIterator lpi2  = (LocPathIterator)expr2;       
        if(null == head)
        {
          head = new MultistepExprHolder(firstOccuranceOwner, stepCount, null);
          tail = head;
          numPathsFound++;
        }
        tail.m_next = new MultistepExprHolder(owner2, stepCount, null);
        tail = tail.m_next;
 
        // Null out the occurance, so we don't have to test it again.
        paths.setElementAt(null, j);
       
        // foundFirst = true;
        numPathsFound++;
      }
    }
  }
 
  // Change all globals in xsl:templates, etc, to global vars no matter what.
  if((0 == numPathsFound) && isGlobal)
  {
      head = new MultistepExprHolder(firstOccuranceOwner, stepCount, null);
      numPathsFound++;
  }
 
  if(null != head)
  {
    ElemTemplateElement root = isGlobal ? psuedoVarRecipient : findCommonAncestor(head);
    LocPathIterator sharedIter = (LocPathIterator)head.m_exprOwner.getExpression();
    ElemVariable var = createPsuedoVarDecl(root, sharedIter, isGlobal);
    if(DIAGNOSE_MULTISTEPLIST)
      System.err.println("Created var: "+var.getName()+(isGlobal ? "(Global)" : ""));
    QName uniquePsuedoVarName = var.getName();
    while(null != head)
View Full Code Here


  int n = paths.size();
  Expression expr1 = firstOccuranceOwner.getExpression();
  if(DEBUG)
    assertIsLocPathIterator(expr1, firstOccuranceOwner);
  boolean isGlobal = (paths == m_absPaths);
  LocPathIterator lpi = (LocPathIterator)expr1;
  for(int j = start; j < n; j++)
  {
    ExpressionOwner owner2 = (ExpressionOwner)paths.elementAt(j);
    if(null != owner2)
    {
      Expression expr2 = owner2.getExpression();
      boolean isEqual = expr2.deepEquals(lpi);
      if(isEqual)
      {     
        LocPathIterator lpi2  = (LocPathIterator)expr2;       
        if(!foundFirst)
        {
          foundFirst = true;
          // Insert variable decl into psuedoVarRecipient
          // We want to insert this into the first legitimate
View Full Code Here

    SubContextList subContextList = xctxt.getCurrentNodeList();
    int currentNode = DTM.NULL;

    if (null != subContextList) {
        if (subContextList instanceof PredicatedNodeTest) {
            LocPathIterator iter = ((PredicatedNodeTest)subContextList)
                                                          .getLocPathIterator();
            currentNode = iter.getCurrentContextNode();
         } else if(subContextList instanceof StepPattern) {
           throw new RuntimeException(XSLMessages.createMessage(
              XSLTErrorResources.ER_PROCESSOR_ERROR,null));
         }
    } else {
View Full Code Here

      WalkingIterator iter = (WalkingIterator)owner.getExpression();
     
      if(DIAGNOSE_MULTISTEPLIST)
        diagnoseLineNumber(iter);
     
      LocPathIterator newIter2 =
          changePartToRef(var.getName(), iter, lengthToTest, isGlobal);
      owner.setExpression(newIter2);
     
      matchedPaths = matchedPaths.m_next;
    }
View Full Code Here

      ExpressionOwner eo = (ExpressionOwner)paths.elementAt(i);
      if(null == eo)
        continue;
       
      // Assuming location path iterators should be OK.
      LocPathIterator lpi = (LocPathIterator)eo.getExpression();
      int numPaths = countSteps(lpi);
      if(numPaths > 1)
      {
        if(null == first)
          first = new MultistepExprHolder(eo, numPaths, null);
View Full Code Here

 
  Expression expr1 = firstOccuranceOwner.getExpression();
  if(DEBUG)
    assertIsLocPathIterator(expr1, firstOccuranceOwner);
  boolean isGlobal = (paths == m_absPaths);
  LocPathIterator lpi = (LocPathIterator)expr1;
  int stepCount = countSteps(lpi);
  for(int j = start; j < n; j++)
  {
    ExpressionOwner owner2 = (ExpressionOwner)paths.elementAt(j);
    if(null != owner2)
    {
      Expression expr2 = owner2.getExpression();
      boolean isEqual = expr2.deepEquals(lpi);
      if(isEqual)
      {     
        LocPathIterator lpi2  = (LocPathIterator)expr2;       
        if(null == head)
        {
          head = new MultistepExprHolder(firstOccuranceOwner, stepCount, null);
          tail = head;
          numPathsFound++;
        }
        tail.m_next = new MultistepExprHolder(owner2, stepCount, null);
        tail = tail.m_next;
 
        // Null out the occurance, so we don't have to test it again.
        paths.setElementAt(null, j);
       
        // foundFirst = true;
        numPathsFound++;
      }
    }
  }
 
  // Change all globals in xsl:templates, etc, to global vars no matter what.
  if((0 == numPathsFound) && isGlobal)
  {
      head = new MultistepExprHolder(firstOccuranceOwner, stepCount, null);
      numPathsFound++;
  }
 
  if(null != head)
  {
    ElemTemplateElement root = isGlobal ? psuedoVarRecipient : findCommonAncestor(head);
    LocPathIterator sharedIter = (LocPathIterator)head.m_exprOwner.getExpression();
    ElemVariable var = createPsuedoVarDecl(root, sharedIter, isGlobal);
    if(DIAGNOSE_MULTISTEPLIST)
      System.err.println("Created var: "+var.getName()+(isGlobal ? "(Global)" : ""));
    QName uniquePsuedoVarName = var.getName();
    while(null != head)
View Full Code Here

  int n = paths.size();
  Expression expr1 = firstOccuranceOwner.getExpression();
  if(DEBUG)
    assertIsLocPathIterator(expr1, firstOccuranceOwner);
  boolean isGlobal = (paths == m_absPaths);
  LocPathIterator lpi = (LocPathIterator)expr1;
  for(int j = start; j < n; j++)
  {
    ExpressionOwner owner2 = (ExpressionOwner)paths.elementAt(j);
    if(null != owner2)
    {
      Expression expr2 = owner2.getExpression();
      boolean isEqual = expr2.deepEquals(lpi);
      if(isEqual)
      {     
        LocPathIterator lpi2  = (LocPathIterator)expr2;       
        if(!foundFirst)
        {
          foundFirst = true;
          // Insert variable decl into psuedoVarRecipient
          // We want to insert this into the first legitimate
View Full Code Here

    // %TBD% Hack city...
    if (null != subContextList && subContextList instanceof PredicatedNodeTest)
    {
      // PredicatedNodeTest iter = (PredicatedNodeTest) xctxt.getSubContextList();
      // LocPathIterator lpi = iter.getLocPathIterator();
      LocPathIterator lpi = xctxt.getCurrentNodeList();

      currentNode = lpi.getCurrentContextNode()
       
    }
    else if(xctxt.getIteratorRoot() != DTM.NULL)
    {
      currentNode = xctxt.getIteratorRoot();
View Full Code Here

    SubContextList iter = xctxt.getSubContextList();
    Node currentNode;

    if (null != iter && iter instanceof PredicatedNodeTest)
    {
      LocPathIterator lpi = ((PredicatedNodeTest)iter).getLocPathIterator();

      currentNode = lpi.getCurrentContextNode();
    }
    else
    {
      ContextNodeList cnl = xctxt.getContextNodeList();
View Full Code Here

          // ISTRUE being used as a dummy value.
          usedrefs.put(ref, ISTRUE);
        }

        LocPathIterator nl =
          kmgr.getNodeSetByKey(xctxt, docContext, keyname, ref,
                               xctxt.getNamespaceContext());

        try
        {
          upi.addIterator((LocPathIterator)nl.clone());
        }
        catch(CloneNotSupportedException cnse)
        {
          // will never happen.
        }
        //mnodeset.addNodesInDocOrder(nl, xctxt); needed??
      }

      upi.initContext(xctxt);

      nodes = new XNodeSet(upi);
    }
    else
    {
      String ref = arg.str();
      LocPathIterator nl = kmgr.getNodeSetByKey(xctxt, docContext, keyname,
                                                ref,
                                                xctxt.getNamespaceContext());

      try
      {
        nodes = new XNodeSet((LocPathIterator)nl.cloneWithReset());
      }
      catch(CloneNotSupportedException cnse)
      {
        // will never happen.
      }
View Full Code Here

TOP

Related Classes of org.apache.xpath.axes.LocPathIterator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.