Class DefaultXPathFactory

java.lang.Object
org.jaxen.expr.DefaultXPathFactory
All Implemented Interfaces:
XPathFactory

public class DefaultXPathFactory extends Object implements XPathFactory
The concrete implementation of the XPathFactory abstract factory.
See Also:
  • Constructor Details

    • DefaultXPathFactory

      public DefaultXPathFactory()
  • Method Details

    • createXPath

      public XPathExpr createXPath(Expr rootExpr) throws JaxenException
      Description copied from interface: XPathFactory
      Create a new XPathExpr from an Expr.
      Specified by:
      createXPath in interface XPathFactory
      Parameters:
      rootExpr - the expression wrapped by the resulting XPathExpr
      Returns:
      an XPathExpr wrapping the root expression
      Throws:
      JaxenException - if expression evaluation fails
    • createPathExpr

      public PathExpr createPathExpr(FilterExpr filterExpr, LocationPath locationPath) throws JaxenException
      Description copied from interface: XPathFactory
      Create a new path expression.
      Specified by:
      createPathExpr in interface XPathFactory
      Parameters:
      filterExpr - the filter expression that starts the path expression
      locationPath - the location path that follows the filter expression
      Returns:
      a path expression formed by concatenating the two arguments
      Throws:
      JaxenException - if expression evaluation fails
    • createRelativeLocationPath

      public LocationPath createRelativeLocationPath() throws JaxenException
      Description copied from interface: XPathFactory
      Create a new empty relative location path.
      Specified by:
      createRelativeLocationPath in interface XPathFactory
      Returns:
      an empty relative location path
      Throws:
      JaxenException - never
    • createAbsoluteLocationPath

      public LocationPath createAbsoluteLocationPath() throws JaxenException
      Description copied from interface: XPathFactory
      Create a new empty absolute location path.
      Specified by:
      createAbsoluteLocationPath in interface XPathFactory
      Returns:
      an empty absolute location path
      Throws:
      JaxenException - never
    • createOrExpr

      public BinaryExpr createOrExpr(Expr lhs, Expr rhs) throws JaxenException
      Description copied from interface: XPathFactory
      Returns a new XPath Or expression.
      Specified by:
      createOrExpr in interface XPathFactory
      Parameters:
      lhs - the left hand side of the expression
      rhs - the right hand side of the expression
      Returns:
      lhs or rhs
      Throws:
      JaxenException - if expression evaluation fails
    • createAndExpr

      public BinaryExpr createAndExpr(Expr lhs, Expr rhs) throws JaxenException
      Description copied from interface: XPathFactory
      Returns a new XPath And expression.
      Specified by:
      createAndExpr in interface XPathFactory
      Parameters:
      lhs - the left hand side of the expression
      rhs - the right hand side of the expression
      Returns:
      lhs and rhs
      Throws:
      JaxenException - if expression evaluation fails
    • createEqualityExpr

      public BinaryExpr createEqualityExpr(Expr lhs, Expr rhs, int equalityOperator) throws JaxenException
      Description copied from interface: XPathFactory
      Returns a new XPath equality expression.
      Specified by:
      createEqualityExpr in interface XPathFactory
      Parameters:
      lhs - the left hand side of the expression
      rhs - the right hand side of the expression
      equalityOperator - Operator.EQUALS or Operator.NOT_EQUALS
      Returns:
      lhs = rhs or lhs != rhs
      Throws:
      JaxenException - if the third argument is not Operator.EQUALS or Operator.NOT_EQUALS
    • createRelationalExpr

      public BinaryExpr createRelationalExpr(Expr lhs, Expr rhs, int relationalOperator) throws JaxenException
      Description copied from interface: XPathFactory
      Returns a new XPath relational expression.
      Specified by:
      createRelationalExpr in interface XPathFactory
      Parameters:
      lhs - the left hand side of the expression
      rhs - the right hand side of the expression
      relationalOperator - Operator.LESS_THAN, Operator.GREATER_THAN, Operator.LESS_THAN_EQUALS, or Operator.GREATER_THAN_EQUALS
      Returns:
      lhs relationalOperator rhs or lhs != rhs
      Throws:
      JaxenException - if the third argument is not a relational operator constant
    • createAdditiveExpr

      public BinaryExpr createAdditiveExpr(Expr lhs, Expr rhs, int additiveOperator) throws JaxenException
      Description copied from interface: XPathFactory
      Returns a new XPath additive expression.
      Specified by:
      createAdditiveExpr in interface XPathFactory
      Parameters:
      lhs - the left hand side of the expression
      rhs - the right hand side of the expression
      additiveOperator - Operator.ADD or Operator.SUBTRACT
      Returns:
      lhs + rhs or lhs - rhs
      Throws:
      JaxenException - if the third argument is not Operator.ADD or Operator.SUBTRACT
    • createMultiplicativeExpr

      public BinaryExpr createMultiplicativeExpr(Expr lhs, Expr rhs, int multiplicativeOperator) throws JaxenException
      Description copied from interface: XPathFactory
      Returns a new XPath multiplicative expression.
      Specified by:
      createMultiplicativeExpr in interface XPathFactory
      Parameters:
      lhs - the left hand side of the expression
      rhs - the right hand side of the expression
      multiplicativeOperator - Operator.MULTIPLY, Operator.DIV, or Operator.MOD
      Returns:
      lhs * rhs, lhs div rhs, or lhs mod rhs
      Throws:
      JaxenException - if the third argument is not a multiplicative operator constant
    • createUnaryExpr

      public Expr createUnaryExpr(Expr expr, int unaryOperator) throws JaxenException
      Description copied from interface: XPathFactory
      Returns a new XPath unary expression.
      Specified by:
      createUnaryExpr in interface XPathFactory
      Parameters:
      expr - the expression to be negated
      unaryOperator - Operator.NEGATIVE
      Returns:
      - expr or expr
      Throws:
      JaxenException - if expression evaluation fails
    • createUnionExpr

      public UnionExpr createUnionExpr(Expr lhs, Expr rhs) throws JaxenException
      Description copied from interface: XPathFactory
      Returns a new XPath union expression.
      Specified by:
      createUnionExpr in interface XPathFactory
      Parameters:
      lhs - the left hand side of the expression
      rhs - the right hand side of the expression
      Returns:
      lhs | rhs
      Throws:
      JaxenException - if expression evaluation fails
    • createFilterExpr

      public FilterExpr createFilterExpr(Expr expr) throws JaxenException
      Description copied from interface: XPathFactory
      Returns a new XPath filter expression.
      Specified by:
      createFilterExpr in interface XPathFactory
      Parameters:
      expr - the basic expression to which the predicate will be added
      Returns:
      the expression with an empty predicate set
      Throws:
      JaxenException - if expression evaluation fails
    • createFunctionCallExpr

      public FunctionCallExpr createFunctionCallExpr(String prefix, String functionName) throws JaxenException
      Description copied from interface: XPathFactory
      Create a new function call expression.
      Specified by:
      createFunctionCallExpr in interface XPathFactory
      Parameters:
      prefix - the namespace prefix of the function
      functionName - the local name of the function
      Returns:
      a function with an empty argument list
      Throws:
      JaxenException - if expression evaluation fails
    • createNumberExpr

      public NumberExpr createNumberExpr(int number) throws JaxenException
      Description copied from interface: XPathFactory
      Create a number expression.
      Specified by:
      createNumberExpr in interface XPathFactory
      Parameters:
      number - the value
      Returns:
      a number expression wrapping that value
      Throws:
      JaxenException - if expression evaluation fails
    • createNumberExpr

      public NumberExpr createNumberExpr(double number) throws JaxenException
      Description copied from interface: XPathFactory
      Create a number expression.
      Specified by:
      createNumberExpr in interface XPathFactory
      Parameters:
      number - the value
      Returns:
      a number expression wrapping that value
      Throws:
      JaxenException - if expression evaluation fails
    • createLiteralExpr

      public LiteralExpr createLiteralExpr(String literal) throws JaxenException
      Description copied from interface: XPathFactory
      Create a string literal expression.
      Specified by:
      createLiteralExpr in interface XPathFactory
      Parameters:
      literal - the value
      Returns:
      a literal expression wrapping that value
      Throws:
      JaxenException - if expression evaluation fails
    • createVariableReferenceExpr

      public VariableReferenceExpr createVariableReferenceExpr(String prefix, String variable) throws JaxenException
      Description copied from interface: XPathFactory
      Create a new variable reference expression.
      Specified by:
      createVariableReferenceExpr in interface XPathFactory
      Parameters:
      prefix - the namespace prefix of the variable
      variable - the local name of the variable
      Returns:
      a variable expression
      Throws:
      JaxenException - if expression evaluation fails
    • createNameStep

      public Step createNameStep(int axis, String prefix, String localName) throws JaxenException
      Description copied from interface: XPathFactory
      Create a step with a named node-test.
      Specified by:
      createNameStep in interface XPathFactory
      Parameters:
      axis - the axis to create the name-test on
      prefix - the namespace prefix for the test
      localName - the local name for the test
      Returns:
      a name step
      Throws:
      JaxenException - if axis is not one of the axis constants
    • createTextNodeStep

      public Step createTextNodeStep(int axis) throws JaxenException
      Description copied from interface: XPathFactory
      Create a step with a text() node-test.
      Specified by:
      createTextNodeStep in interface XPathFactory
      Parameters:
      axis - the axis to create the text() node-test on
      Returns:
      a text node step
      Throws:
      JaxenException - if axis is not one of the axis constants
    • createCommentNodeStep

      public Step createCommentNodeStep(int axis) throws JaxenException
      Description copied from interface: XPathFactory
      Create a step with a comment() node-test.
      Specified by:
      createCommentNodeStep in interface XPathFactory
      Parameters:
      axis - the axis to create the comment() node-test on
      Returns:
      a comment node step
      Throws:
      JaxenException - if axis is not one of the axis constants
    • createAllNodeStep

      public Step createAllNodeStep(int axis) throws JaxenException
      Description copied from interface: XPathFactory
      Create a step with a node() node-test.
      Specified by:
      createAllNodeStep in interface XPathFactory
      Parameters:
      axis - the axis to create the node-test on
      Returns:
      an all node step
      Throws:
      JaxenException - if axis is not one of the axis constants
    • createProcessingInstructionNodeStep

      public Step createProcessingInstructionNodeStep(int axis, String piName) throws JaxenException
      Description copied from interface: XPathFactory
      Create a step with a processing-instruction() node-test.
      Specified by:
      createProcessingInstructionNodeStep in interface XPathFactory
      Parameters:
      axis - the axis to create the processing-instruction() node-test on
      piName - the target to match, may be empty
      Returns:
      a processing instruction node step
      Throws:
      JaxenException - if axis is not one of the axis constants
    • createPredicate

      public Predicate createPredicate(Expr predicateExpr) throws JaxenException
      Description copied from interface: XPathFactory
      Create from the supplied expression.
      Specified by:
      createPredicate in interface XPathFactory
      Parameters:
      predicateExpr - the expression to evaluate in the predicate
      Returns:
      a predicate
      Throws:
      JaxenException - if expression evaluation fails
    • getIterableAxis

      protected IterableAxis getIterableAxis(int axis) throws JaxenException
      Throws:
      JaxenException
    • createPredicateSet

      public PredicateSet createPredicateSet() throws JaxenException
      Description copied from interface: XPathFactory
      Create an empty predicate set.
      Specified by:
      createPredicateSet in interface XPathFactory
      Returns:
      an empty predicate set
      Throws:
      JaxenException - never