Class ExpressionVisitor

java.lang.Object
net.sf.saxon.expr.parser.ExpressionVisitor

public class ExpressionVisitor extends Object
The ExpressionVisitor supports the various phases of processing of an expression tree which require a recursive walk of the tree structure visiting each node in turn. In maintains a stack holding the ancestor nodes of the node currently being visited.
  • Constructor Details

    • ExpressionVisitor

      public ExpressionVisitor(Configuration config)
      Create an ExpressionVisitor
      Parameters:
      config - the Saxon configuration
  • Method Details

    • getConfiguration

      public Configuration getConfiguration()
      Get the Configuration
      Returns:
      the configuration
    • getStaticContext

      public StaticContext getStaticContext()
      Get the static context for the expressions being visited. Note: this may not reflect all changes in static context (e.g. namespace context, base URI) applying to nested expressions
      Returns:
      the static context
    • setStaticContext

      public void setStaticContext(StaticContext staticContext)
      Set the static context for the expressions being visited. Note: this may not reflect all changes in static context (e.g. namespace context, base URI) applying to nested expressions
      Parameters:
      staticContext - the static context
    • make

      public static ExpressionVisitor make(StaticContext env)
      Factory method: make an expression visitor
      Parameters:
      env - the static context
      Returns:
      the new expression visitor
    • issueWarning

      public void issueWarning(String message, String errorCode, Location locator)
      Issue a warning message
      Parameters:
      message - the message
      errorCode - the error code associated with the message
      locator - the query/stylesheet location associated with the message
    • makeDynamicContext

      public XPathContext makeDynamicContext()
      Create a dynamic context suitable for early evaluation of constant subexpressions
      Returns:
      a dynamic evaluation context
    • obtainOptimizer

      public Optimizer obtainOptimizer()
      Obtain an optimizer. The optimizer is created on the first call of this method and is retained for use in subsequent calls.
      Returns:
      a suitable optimizer, taking into account the optimization options defined by the Configuration and by the static context
    • setOptimizeForStreaming

      public void setOptimizeForStreaming(boolean option)
      Tell the visitor to optimize expressions for evaluation in a streaming environment
      Parameters:
      option - true if optimizing for streaming
    • isOptimizeForStreaming

      public boolean isOptimizeForStreaming()
      Ask whether the visitor is to optimize expressions for evaluation in a streaming environment
      Returns:
      true if optimizing for streaming
    • setOptimizeForPatternMatching

      public void setOptimizeForPatternMatching(boolean option)
      Tell the visitor to optimize expressions for evaluation as an XSLT match pattern
      Parameters:
      option - true if optimizing for pattern matching
    • isOptimizeForPatternMatching

      public boolean isOptimizeForPatternMatching()
      Ask whether the visitor is to optimize expressions for evaluation as an XSLT match pattern
      Returns:
      true if optimizing for pattern matching
    • getTargetEdition

      public String getTargetEdition()
      Get the target environment for which we are optimizing
      Returns:
      the target environment (for example "EE" or "JS"). Defaults to the edition of the current configuration
    • incrementAndTestDepth

      public boolean incrementAndTestDepth()
      Increment and test depth
      Returns:
      true if the current depth is less than a maximum limit; and increment the current depth
    • decrementDepth

      public void decrementDepth()
      Decrement depth
    • isSuppressWarnings

      public boolean isSuppressWarnings()
      Ask if warnings have been suppressed. This typically happens when processing code that has been copied, to prevent multiple warnings for the same code
      Returns:
      true if warnings are suppressed
    • setSuppressWarnings

      public void setSuppressWarnings(boolean suppressWarnings)
      Say whether warnings should be suppressed. This is typically done when processing code that has been copied, to prevent multiple warnings for the same code
      Parameters:
      suppressWarnings - set to true to suppress warnings
    • isInliningFunctions

      public boolean isInliningFunctions()
    • setInliningFunctions

      public void setInliningFunctions(boolean inliningFunctions)