Java源码示例:org.apache.xpath.compiler.Compiler

示例1
/**
 * Create a LocPathIterator object, including creation
 * of step walkers from the opcode list, and call back
 * into the Compiler to create predicate expressions.
 *
 * @param compiler The Compiler which is creating
 * this expression.
 * @param opPos The position of this iterator in the
 * opcode list from the compiler.
 *
 * @throws javax.xml.transform.TransformerException
 */
protected BasicTestIterator(Compiler compiler, int opPos, int analysis)
        throws javax.xml.transform.TransformerException
{
  super(compiler, opPos, analysis, false);
  
  int firstStepPos = OpMap.getFirstChildPos(opPos);
  int whatToShow = compiler.getWhatToShow(firstStepPos);

  if ((0 == (whatToShow
             & (DTMFilter.SHOW_ATTRIBUTE 
             | DTMFilter.SHOW_NAMESPACE 
             | DTMFilter.SHOW_ELEMENT
             | DTMFilter.SHOW_PROCESSING_INSTRUCTION))) 
             || (whatToShow == DTMFilter.SHOW_ALL))
    initNodeTest(whatToShow);
  else
  {
    initNodeTest(whatToShow, compiler.getStepNS(firstStepPos),
                            compiler.getStepLocalName(firstStepPos));
  }
  initPredicateInfo(compiler, firstStepPos);
}
 
示例2
/**
 * Init predicate info.
 *
 * @param compiler The Compiler object that has information about this 
 *                 walker in the op map.
 * @param opPos The op code position of this location step.
 *
 * @throws javax.xml.transform.TransformerException
 */
protected void initPredicateInfo(Compiler compiler, int opPos)
        throws javax.xml.transform.TransformerException
{

  int pos = compiler.getFirstPredicateOpPos(opPos);

  if(pos > 0)
  {
    m_predicates = compiler.getCompiledPredicates(pos);
    if(null != m_predicates)
    {
    	for(int i = 0; i < m_predicates.length; i++)
    	{
    		m_predicates[i].exprSetParent(this);
    	}
    }
  }
}
 
示例3
/**
 * This method is for building an array of possible levels
 * where the target element(s) could be found for a match.
 * @param lpi The owning location path iterator.
 * @param compiler non-null reference to compiler object that has processed
 *                 the XPath operations into an opcode map.
 * @param stepOpCodePos The opcode position for the step.
 *
 * @return non-null AxesWalker derivative.
 *
 * @throws javax.xml.transform.TransformerException
 * @xsl.usage advanced
 */
static AxesWalker loadOneWalker(
        WalkingIterator lpi, Compiler compiler, int stepOpCodePos)
          throws javax.xml.transform.TransformerException
{

  AxesWalker firstWalker = null;
  int stepType = compiler.getOp(stepOpCodePos);

  if (stepType != OpCodes.ENDOP)
  {

    // m_axesWalkers = new AxesWalker[1];
    // As we unwind from the recursion, create the iterators.
    firstWalker = createDefaultWalker(compiler, stepType, lpi, 0);

    firstWalker.init(compiler, stepOpCodePos, stepType);
  }

  return firstWalker;
}
 
示例4
/**
 * Analyze a step and give information about it's predicates.  Right now this
 * just returns true or false if the step has a predicate.
 *
 * @param compiler non-null reference to compiler object that has processed
 *                 the XPath operations into an opcode map.
 * @param opPos The opcode position for the step.
 * @param stepType The type of step, one of OP_GROUP, etc.
 *
 * @return true if step has a predicate.
 *
 * @throws javax.xml.transform.TransformerException
 */
static boolean analyzePredicate(Compiler compiler, int opPos, int stepType)
        throws javax.xml.transform.TransformerException
{

  int argLen;

  switch (stepType)
  {
  case OpCodes.OP_VARIABLE :
  case OpCodes.OP_EXTFUNCTION :
  case OpCodes.OP_FUNCTION :
  case OpCodes.OP_GROUP :
    argLen = compiler.getArgLength(opPos);
    break;
  default :
    argLen = compiler.getArgLengthOfStep(opPos);
  }

  int pos = compiler.getFirstPredicateOpPos(opPos);
  int nPredicates = compiler.countPredicates(pos);

  return (nPredicates > 0) ? true : false;
}
 
示例5
/**
 * Create a OneStepIterator object.
 *
 * @param compiler A reference to the Compiler that contains the op map.
 * @param opPos The position within the op map, which contains the
 * location path expression for this itterator.
 *
 * @throws javax.xml.transform.TransformerException
 */
OneStepIterator(Compiler compiler, int opPos, int analysis)
        throws javax.xml.transform.TransformerException
{
  super(compiler, opPos, analysis);
  int firstStepPos = OpMap.getFirstChildPos(opPos);
  
  m_axis = WalkerFactory.getAxisFromStep(compiler, firstStepPos);
  
}
 
示例6
/**
 * This method is for building an array of possible levels
 * where the target element(s) could be found for a match.
 * @param lpi The owning location path iterator object.
 * @param compiler non-null reference to compiler object that has processed
 *                 the XPath operations into an opcode map.
 * @param stepOpCodePos The opcode position for the step.
 * @param stepIndex The top-level step index withing the iterator.
 *
 * @return non-null AxesWalker derivative.
 *
 * @throws javax.xml.transform.TransformerException
 * @xsl.usage advanced
 */
static AxesWalker loadWalkers(
        WalkingIterator lpi, Compiler compiler, int stepOpCodePos, int stepIndex)
          throws javax.xml.transform.TransformerException
{

  int stepType;
  AxesWalker firstWalker = null;
  AxesWalker walker, prevWalker = null;

  int analysis = analyze(compiler, stepOpCodePos, stepIndex);

  while (OpCodes.ENDOP != (stepType = compiler.getOp(stepOpCodePos)))
  {
    walker = createDefaultWalker(compiler, stepOpCodePos, lpi, analysis);

    walker.init(compiler, stepOpCodePos, stepType);
    walker.exprSetParent(lpi);

    // walker.setAnalysis(analysis);
    if (null == firstWalker)
    {
      firstWalker = walker;
    }
    else
    {
      prevWalker.setNextWalker(walker);
      walker.setPrevWalker(prevWalker);
    }

    prevWalker = walker;
    stepOpCodePos = compiler.getNextStepPos(stepOpCodePos);

    if (stepOpCodePos < 0)
      break;
  }

  return firstWalker;
}
 
示例7
static boolean functionProximateOrContainsProximate(Compiler compiler, 
                                                    int opPos)
{
  int endFunc = opPos + compiler.getOp(opPos + 1) - 1;
  opPos = OpMap.getFirstChildPos(opPos);
  int funcID = compiler.getOp(opPos);
  //  System.out.println("funcID: "+funcID);
  //  System.out.println("opPos: "+opPos);
  //  System.out.println("endFunc: "+endFunc);
  switch(funcID)
  {
    case FunctionTable.FUNC_LAST:
    case FunctionTable.FUNC_POSITION:
      return true;
    default:
      opPos++;
      int i = 0;
      for (int p = opPos; p < endFunc; p = compiler.getNextOpPos(p), i++)
      {
        int innerExprOpPos = p+2;
        int argOp = compiler.getOp(innerExprOpPos);
        boolean prox = isProximateInnerExpr(compiler, innerExprOpPos);
        if(prox)
          return true;
      }

  }
  return false;
}
 
示例8
static boolean isProximateInnerExpr(Compiler compiler, int opPos)
{
  int op = compiler.getOp(opPos);
  int innerExprOpPos = opPos+2;
  switch(op)
  {
    case OpCodes.OP_ARGUMENT:
      if(isProximateInnerExpr(compiler, innerExprOpPos))
        return true;
      break;
    case OpCodes.OP_VARIABLE:
    case OpCodes.OP_NUMBERLIT:
    case OpCodes.OP_LITERAL:
    case OpCodes.OP_LOCATIONPATH:
      break; // OK
    case OpCodes.OP_FUNCTION:
      boolean isProx = functionProximateOrContainsProximate(compiler, opPos);
      if(isProx)
        return true;
      break;
    case OpCodes.OP_GT:
    case OpCodes.OP_GTE:
    case OpCodes.OP_LT:
    case OpCodes.OP_LTE:
    case OpCodes.OP_EQUALS:
      int leftPos = OpMap.getFirstChildPos(op);
      int rightPos = compiler.getNextOpPos(leftPos);
      isProx = isProximateInnerExpr(compiler, leftPos);
      if(isProx)
        return true;
      isProx = isProximateInnerExpr(compiler, rightPos);
      if(isProx)
        return true;
      break;
    default:
      return true; // be conservative...
  }
  return false;
}
 
示例9
/**
 * Create a OneStepIterator object.
 *
 * @param compiler A reference to the Compiler that contains the op map.
 * @param opPos The position within the op map, which contains the
 * location path expression for this itterator.
 *
 * @throws javax.xml.transform.TransformerException
 */
OneStepIteratorForward(Compiler compiler, int opPos, int analysis)
        throws javax.xml.transform.TransformerException
{
  super(compiler, opPos, analysis);
  int firstStepPos = OpMap.getFirstChildPos(opPos);
  
  m_axis = WalkerFactory.getAxisFromStep(compiler, firstStepPos);
  
}
 
示例10
/**
 * Construct an XPath object.  
 *
 * (Needs review -sc) This method initializes an XPathParser/
 * Compiler and compiles the expression.
 * @param exprString The XPath expression.
 * @param locator The location of the expression, may be null.
 * @param prefixResolver A prefix resolver to use to resolve prefixes to 
 *                       namespace URIs.
 * @param type one of {@link #SELECT} or {@link #MATCH}.
 * @param errorListener The error listener, or null if default should be used.
 *
 * @throws javax.xml.transform.TransformerException if syntax or other error.
 */
public XPath(
        String exprString, SourceLocator locator, PrefixResolver prefixResolver, int type,
        ErrorListener errorListener)
          throws javax.xml.transform.TransformerException
{ 
  initFunctionTable();     
  if(null == errorListener)
    errorListener = new org.apache.xml.utils.DefaultErrorHandler();
  
  m_patternString = exprString;

  XPathParser parser = new XPathParser(errorListener, locator);
  Compiler compiler = new Compiler(errorListener, locator, m_funcTable);

  if (SELECT == type)
    parser.initXPath(compiler, exprString, prefixResolver);
  else if (MATCH == type)
    parser.initMatchPattern(compiler, exprString, prefixResolver);
  else
    throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_CANNOT_DEAL_XPATH_TYPE, new Object[]{Integer.toString(type)})); //"Can not deal with XPath type: " + type);

  // System.out.println("----------------");
  Expression expr = compiler.compile(0);

  // System.out.println("expr: "+expr);
  this.setExpression(expr);
  
  if((null != locator) && locator instanceof ExpressionNode)
  {
  	expr.exprSetParent((ExpressionNode)locator);
  }

}
 
示例11
/**
 * Construct an XPath object.  
 *
 * (Needs review -sc) This method initializes an XPathParser/
 * Compiler and compiles the expression.
 * @param exprString The XPath expression.
 * @param locator The location of the expression, may be null.
 * @param prefixResolver A prefix resolver to use to resolve prefixes to 
 *                       namespace URIs.
 * @param type one of {@link #SELECT} or {@link #MATCH}.
 * @param errorListener The error listener, or null if default should be used.
 *
 * @throws javax.xml.transform.TransformerException if syntax or other error.
 */
public XPath(
        String exprString, SourceLocator locator, 
        PrefixResolver prefixResolver, int type,
        ErrorListener errorListener, FunctionTable aTable)
          throws javax.xml.transform.TransformerException
{ 
  m_funcTable = aTable;     
  if(null == errorListener)
    errorListener = new org.apache.xml.utils.DefaultErrorHandler();
  
  m_patternString = exprString;

  XPathParser parser = new XPathParser(errorListener, locator);
  Compiler compiler = new Compiler(errorListener, locator, m_funcTable);

  if (SELECT == type)
    parser.initXPath(compiler, exprString, prefixResolver);
  else if (MATCH == type)
    parser.initMatchPattern(compiler, exprString, prefixResolver);
  else
    throw new RuntimeException(XSLMessages.createXPATHMessage(
          XPATHErrorResources.ER_CANNOT_DEAL_XPATH_TYPE, 
          new Object[]{Integer.toString(type)})); 
          //"Can not deal with XPath type: " + type);

  // System.out.println("----------------");
  Expression expr = compiler.compile(0);

  // System.out.println("expr: "+expr);
  this.setExpression(expr);
  
  if((null != locator) && locator instanceof ExpressionNode)
  {
  	expr.exprSetParent((ExpressionNode)locator);
  }

}
 
示例12
/**
 * Create a LocPathIterator object, including creation
 * of step walkers from the opcode list, and call back
 * into the Compiler to create predicate expressions.
 *
 * @param compiler The Compiler which is creating
 * this expression.
 * @param opPos The position of this iterator in the
 * opcode list from the compiler.
 * @param analysis Analysis bits that give general information about the 
 * LocationPath.
 *
 * @throws javax.xml.transform.TransformerException
 */
MatchPatternIterator(Compiler compiler, int opPos, int analysis)
        throws javax.xml.transform.TransformerException
{

  super(compiler, opPos, analysis, false);

  int firstStepPos = OpMap.getFirstChildPos(opPos);

  m_pattern = WalkerFactory.loadSteps(this, compiler, firstStepPos, 0); 

  boolean fromRoot = false;
  boolean walkBack = false;
  boolean walkDescendants = false;
  boolean walkAttributes = false;

  if (0 != (analysis & (WalkerFactory.BIT_ROOT | 
                        WalkerFactory.BIT_ANY_DESCENDANT_FROM_ROOT)))
    fromRoot = true;
    
  if (0 != (analysis
            & (WalkerFactory.BIT_ANCESTOR
               | WalkerFactory.BIT_ANCESTOR_OR_SELF
               | WalkerFactory.BIT_PRECEDING
               | WalkerFactory.BIT_PRECEDING_SIBLING 
               | WalkerFactory.BIT_FOLLOWING
               | WalkerFactory.BIT_FOLLOWING_SIBLING
               | WalkerFactory.BIT_PARENT | WalkerFactory.BIT_FILTER)))
    walkBack = true;

  if (0 != (analysis
            & (WalkerFactory.BIT_DESCENDANT_OR_SELF
               | WalkerFactory.BIT_DESCENDANT
               | WalkerFactory.BIT_CHILD)))
    walkDescendants = true;

  if (0 != (analysis
            & (WalkerFactory.BIT_ATTRIBUTE | WalkerFactory.BIT_NAMESPACE)))
    walkAttributes = true;
    
  if(false || DEBUG)
  {
    System.out.print("analysis: "+Integer.toBinaryString(analysis));
    System.out.println(", "+WalkerFactory.getAnalysisString(analysis));
  }
    
  if(fromRoot || walkBack)
  {
    if(walkAttributes)
    {
      m_superAxis = Axis.ALL;
    }
    else
    {
      m_superAxis = Axis.DESCENDANTSFROMROOT;
    }
  }
  else if(walkDescendants)
  {
    if(walkAttributes)
    {
      m_superAxis = Axis.ALLFROMNODE;
    }
    else
    {
      m_superAxis = Axis.DESCENDANTORSELF;
    }
  }
  else
  {
    m_superAxis = Axis.ALL;
  }
  if(false || DEBUG)
  {
    System.out.println("axis: "+Axis.getNames(m_superAxis));
  }
  
}
 
示例13
/**
   * Init a FilterExprWalker.
   *
   * @param compiler non-null reference to the Compiler that is constructing.
   * @param opPos positive opcode position for this step.
   * @param stepType The type of step.
   *
   * @throws javax.xml.transform.TransformerException
   */
  public void init(Compiler compiler, int opPos, int stepType)
          throws javax.xml.transform.TransformerException
  {

    super.init(compiler, opPos, stepType);

    // Smooth over an anomily in the opcode map...
    switch (stepType)
    {
    case OpCodes.OP_FUNCTION :
    case OpCodes.OP_EXTFUNCTION :
    	m_mustHardReset = true;
    case OpCodes.OP_GROUP :
    case OpCodes.OP_VARIABLE :
      m_expr = compiler.compile(opPos);
      m_expr.exprSetParent(this);
      //if((OpCodes.OP_FUNCTION == stepType) && (m_expr instanceof org.apache.xalan.templates.FuncKey))
      if(m_expr instanceof org.apache.xpath.operations.Variable)
      {
      	// hack/temp workaround
      	m_canDetachNodeset = false;
      }
      break;
    default :
      m_expr = compiler.compile(opPos + 2);
      m_expr.exprSetParent(this);
    }
//    if(m_expr instanceof WalkingIterator)
//    {
//      WalkingIterator wi = (WalkingIterator)m_expr;
//      if(wi.getFirstWalker() instanceof FilterExprWalker)
//      {
//      	FilterExprWalker fw = (FilterExprWalker)wi.getFirstWalker();
//      	if(null == fw.getNextWalker())
//      	{
//      		m_expr = fw.m_expr;
//      		m_expr.exprSetParent(this);
//      	}
//      }
//      		
//    }
  }
 
示例14
/**
 * Initialize the location path iterators.  Recursive.
 *
 * @param compiler The Compiler which is creating 
 * this expression.
 * @param opPos The position of this iterator in the 
 * opcode list from the compiler.
 * @param count The insert position of the iterator.
 *
 * @throws javax.xml.transform.TransformerException
 */
protected void loadLocationPaths(Compiler compiler, int opPos, int count)
        throws javax.xml.transform.TransformerException
{

  // TODO: Handle unwrapped FilterExpr
  int steptype = compiler.getOp(opPos);

  if (steptype == OpCodes.OP_LOCATIONPATH)
  {
    loadLocationPaths(compiler, compiler.getNextOpPos(opPos), count + 1);

    m_exprs[count] = createDTMIterator(compiler, opPos);
    m_exprs[count].exprSetParent(this);
  }
  else
  {

    // Have to check for unwrapped functions, which the LocPathIterator
    // doesn't handle. 
    switch (steptype)
    {
    case OpCodes.OP_VARIABLE :
    case OpCodes.OP_EXTFUNCTION :
    case OpCodes.OP_FUNCTION :
    case OpCodes.OP_GROUP :
      loadLocationPaths(compiler, compiler.getNextOpPos(opPos), count + 1);

      WalkingIterator iter =
        new WalkingIterator(compiler.getNamespaceContext());
      iter.exprSetParent(this);
        
      if(compiler.getLocationPathDepth() <= 0)
        iter.setIsTopLevel(true);

      iter.m_firstWalker = new org.apache.xpath.axes.FilterExprWalker(iter);

      iter.m_firstWalker.init(compiler, opPos, steptype);

      m_exprs[count] = iter;
      break;
    default :
      m_exprs = new LocPathIterator[count];
    }
  }
}
 
示例15
public static void diagnoseIterator(String name, int analysis, Compiler compiler)
{
  System.out.println(compiler.toString()+", "+name+", "
                           + Integer.toBinaryString(analysis) + ", "
                           + getAnalysisString(analysis));
}
 
示例16
/**
 * Special purpose function to see if we can optimize the pattern for 
 * a DescendantIterator.
 *
 * @param compiler non-null reference to compiler object that has processed
 *                 the XPath operations into an opcode map.
 * @param stepOpCodePos The opcode position for the step.
 *
 * @return 32 bits as an integer that give information about the location
 * path as a whole.
 *
 * @throws javax.xml.transform.TransformerException
 */
public static int getAxisFromStep(
        Compiler compiler, int stepOpCodePos)
          throws javax.xml.transform.TransformerException
{

  int stepType = compiler.getOp(stepOpCodePos);

  switch (stepType)
  {
  case OpCodes.FROM_FOLLOWING :
    return Axis.FOLLOWING;
  case OpCodes.FROM_FOLLOWING_SIBLINGS :
    return Axis.FOLLOWINGSIBLING;
  case OpCodes.FROM_PRECEDING :
    return Axis.PRECEDING;
  case OpCodes.FROM_PRECEDING_SIBLINGS :
    return Axis.PRECEDINGSIBLING;
  case OpCodes.FROM_PARENT :
    return Axis.PARENT;
  case OpCodes.FROM_NAMESPACE :
    return Axis.NAMESPACE;
  case OpCodes.FROM_ANCESTORS :
    return Axis.ANCESTOR;
  case OpCodes.FROM_ANCESTORS_OR_SELF :
    return Axis.ANCESTORORSELF;
  case OpCodes.FROM_ATTRIBUTES :
    return Axis.ATTRIBUTE;
  case OpCodes.FROM_ROOT :
    return Axis.ROOT;
  case OpCodes.FROM_CHILDREN :
    return Axis.CHILD;
  case OpCodes.FROM_DESCENDANTS_OR_SELF :
    return Axis.DESCENDANTORSELF;
  case OpCodes.FROM_DESCENDANTS :
    return Axis.DESCENDANT;
  case OpCodes.FROM_SELF :
    return Axis.SELF;
  case OpCodes.OP_EXTFUNCTION :
  case OpCodes.OP_FUNCTION :
  case OpCodes.OP_GROUP :
  case OpCodes.OP_VARIABLE :
    return Axis.FILTEREDLIST;
  }

  throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NULL_ERROR_HANDLER, new Object[]{Integer.toString(stepType)})); //"Programmer's assertion: unknown opcode: "
                             //+ stepType);
 }
 
示例17
/**
 * Figure out if we're executing a toplevel expression.
 * If so, we can't be inside of a predicate. 
 */
public void postCompileStep(Compiler compiler)
{
  m_isTopLevel = compiler.getLocationPathDepth() == -1;
}
 
示例18
/**
 * Figure out if we're executing a toplevel expression.
 * If so, we can't be inside of a predicate. 
 */
public void postCompileStep(Compiler compiler)
{
  m_isTopLevel = compiler.getLocationPathDepth() == -1;
}
 
示例19
/**
 * This function is currently only being used by Position()
 * and Last(). See respective functions for more detail.
 */
public void postCompileStep(Compiler compiler)
{
  // no default action
}
 
示例20
/**
 * Create a LocPathIterator object, including creation
 * of step walkers from the opcode list, and call back
 * into the Compiler to create predicate expressions.
 *
 * @param compiler The Compiler which is creating
 * this expression.
 * @param opPos The position of this iterator in the
 * opcode list from the compiler.
 * @param shouldLoadWalkers True if walkers should be
 * loaded, or false if this is a derived iterator and
 * it doesn't wish to load child walkers.
 *
 * @throws javax.xml.transform.TransformerException
 */
protected BasicTestIterator(
        Compiler compiler, int opPos, int analysis, boolean shouldLoadWalkers)
          throws javax.xml.transform.TransformerException
{
  super(compiler, opPos, analysis, shouldLoadWalkers);
}
 
示例21
/**
 * Create a WalkingIterator iterator, including creation
 * of step walkers from the opcode list, and call back
 * into the Compiler to create predicate expressions.
 *
 * @param compiler The Compiler which is creating
 * this expression.
 * @param opPos The position of this iterator in the
 * opcode list from the compiler.
 * @param shouldLoadWalkers True if walkers should be
 * loaded, or false if this is a derived iterator and
 * it doesn't wish to load child walkers.
 *
 * @throws javax.xml.transform.TransformerException
 */
WalkingIterator(
        Compiler compiler, int opPos, int analysis, boolean shouldLoadWalkers)
          throws javax.xml.transform.TransformerException
{
  super(compiler, opPos, analysis, shouldLoadWalkers);
  
  int firstStepPos = OpMap.getFirstChildPos(opPos);

  if (shouldLoadWalkers)
  {
    m_firstWalker = WalkerFactory.loadWalkers(this, compiler, firstStepPos, 0);
    m_lastUsedWalker = m_firstWalker;
  }
}
 
示例22
/**
 * Create a LocPathIterator object, including creation
 * of step walkers from the opcode list, and call back
 * into the Compiler to create predicate expressions.
 *
 * @param compiler The Compiler which is creating
 * this expression.
 * @param opPos The position of this iterator in the
 * opcode list from the compiler.
 * @param shouldLoadWalkers True if walkers should be
 * loaded, or false if this is a derived iterator and
 * it doesn't wish to load child walkers.
 *
 * @throws javax.xml.transform.TransformerException
 */
protected LocPathIterator(
        Compiler compiler, int opPos, int analysis, boolean shouldLoadWalkers)
          throws javax.xml.transform.TransformerException
{
  setLocPathIterator(this);
}
 
示例23
/**
 * Create a ChildIterator object.
 *
 * @param compiler A reference to the Compiler that contains the op map.
 * @param opPos The position within the op map, which contains the
 * location path expression for this itterator.
 * @param analysis Analysis bits of the entire pattern.
 *
 * @throws javax.xml.transform.TransformerException
 */
ChildIterator(Compiler compiler, int opPos, int analysis)
        throws javax.xml.transform.TransformerException
{
  super(compiler, opPos, analysis, false);

  // This iterator matches all kinds of nodes
  initNodeTest(DTMFilter.SHOW_ALL);
}
 
示例24
/**
 * Create a WalkingIterator iterator, including creation
 * of step walkers from the opcode list, and call back
 * into the Compiler to create predicate expressions.
 *
 * @param compiler The Compiler which is creating
 * this expression.
 * @param opPos The position of this iterator in the
 * opcode list from the compiler.
 * @param shouldLoadWalkers True if walkers should be
 * loaded, or false if this is a derived iterator and
 * it doesn't wish to load child walkers.
 *
 * @throws javax.xml.transform.TransformerException
 */
WalkingIteratorSorted(
        Compiler compiler, int opPos, int analysis, boolean shouldLoadWalkers)
          throws javax.xml.transform.TransformerException
{
  super(compiler, opPos, analysis, shouldLoadWalkers);
}
 
示例25
/**
 * Create a UnionPathIterator object, including creation 
 * of location path iterators from the opcode list, and call back 
 * into the Compiler to create predicate expressions.
 *
 * @param compiler The Compiler which is creating 
 * this expression.
 * @param opPos The position of this iterator in the 
 * opcode list from the compiler.
 *
 * @throws javax.xml.transform.TransformerException
 */
public UnionPathIterator(Compiler compiler, int opPos)
        throws javax.xml.transform.TransformerException
{

  super();

  opPos = OpMap.getFirstChildPos(opPos);

  loadLocationPaths(compiler, opPos, 0);
}
 
示例26
/**
 * Create a new location path iterator.
 *
 * @param compiler The Compiler which is creating 
 * this expression.
 * @param opPos The position of this iterator in the 
 *
 * @return New location path iterator.
 *
 * @throws javax.xml.transform.TransformerException
 */
protected LocPathIterator createDTMIterator(
        Compiler compiler, int opPos) throws javax.xml.transform.TransformerException
{
  LocPathIterator lpi = (LocPathIterator)WalkerFactory.newDTMIterator(compiler, opPos, 
                                    (compiler.getLocationPathDepth() <= 0));
  return lpi;
}
 
示例27
/**
 * Initialize an AxesWalker during the parse of the XPath expression.
 *
 * @param compiler The Compiler object that has information about this 
 *                 walker in the op map.
 * @param opPos The op code position of this location step.
 * @param stepType  The type of location step.
 *
 * @throws javax.xml.transform.TransformerException
 */
public void init(Compiler compiler, int opPos, int stepType)
        throws javax.xml.transform.TransformerException
{

  initPredicateInfo(compiler, opPos);

  // int testType = compiler.getOp(nodeTestOpPos);
}
 
示例28
/**
 * Create a ChildTestIterator object.
 *
 * @param compiler A reference to the Compiler that contains the op map.
 * @param opPos The position within the op map, which contains the
 * location path expression for this itterator.
 *
 * @throws javax.xml.transform.TransformerException
 */
ChildTestIterator(Compiler compiler, int opPos, int analysis)
        throws javax.xml.transform.TransformerException
{
  super(compiler, opPos, analysis);
}
 
示例29
/**
 * Create a LocPathIterator object, including creation
 * of step walkers from the opcode list, and call back
 * into the Compiler to create predicate expressions.
 *
 * @param compiler The Compiler which is creating
 * this expression.
 * @param opPos The position of this iterator in the
 * opcode list from the compiler.
 *
 * @throws javax.xml.transform.TransformerException
 */
protected LocPathIterator(Compiler compiler, int opPos, int analysis)
        throws javax.xml.transform.TransformerException
{
  this(compiler, opPos, analysis, true);
}
 
示例30
/**
 * Create a AttributeIterator object.
 *
 * @param compiler A reference to the Compiler that contains the op map.
 * @param opPos The position within the op map, which contains the
 * location path expression for this itterator.
 *
 * @throws javax.xml.transform.TransformerException
 */
AttributeIterator(Compiler compiler, int opPos, int analysis)
        throws javax.xml.transform.TransformerException
{
  super(compiler, opPos, analysis);
}