Enhydra 3.1 API

org.apache.xalan.xpath
Class XPathProcessorImpl

java.lang.Object
  |
  +--org.apache.xalan.xpath.XPathProcessorImpl

public class XPathProcessorImpl
extends java.lang.Object
implements XPathProcessor, java.io.Serializable

Tokenizes and parses XPath expressions. This should really be named XPathParserImpl, and may be renamed in the future.

See Also:
Serialized Form

Constructor Summary
XPathProcessorImpl()
          The parser constructor.
XPathProcessorImpl(XPathSupport callbacks)
          The parser constructor.
 
Method Summary
protected  void AbbreviatedNodeTestStep()
          AbbreviatedNodeTestStep ::= '@'? NodeTest Predicate*
protected  int AdditiveExpr(int addPos)
          XXXX.
protected  void AndExpr()
          AndExpr ::= EqualityExpr | AndExpr 'and' EqualityExpr
protected  void Argument()
          Argument ::= Expr
protected  int AxisName()
          Basis ::= AxisName '::' NodeTest | AbbreviatedBasis
protected  void Basis()
          Basis ::= AxisName '::' NodeTest | AbbreviatedBasis
protected  void BooleanExpr()
          StringExpr ::= Expr
static void diagnoseXPathString(java.lang.String str)
          Dump an XPath string to System.out.
static void diagnoseXPathString2(java.lang.String str)
          Dump an XPath string to System.out.
static void diagnoseXPathString3(java.lang.String str)
          Dump an XPath string to System.out.
protected  java.lang.String dumpRemainingTokenQueue()
          Dump the remaining token queue.
protected  int EqualityExpr(int addPos)
           
protected  void Expr()
          Expr ::= OrExpr
protected  void FilterExpr()
          FilterExpr ::= PrimaryExpr | FilterExpr Predicate
protected  void FunctionCall()
          FunctionCall ::= FunctionName '(' ( Argument ( ',' Argument)*)? ')'
protected  void IdKeyPattern()
          IdKeyPattern ::= 'id' '(' Literal ')' | 'key' '(' Literal ',' Literal ')' (Also handle doc())
 void initMatchPattern(XPath pathObj, java.lang.String expression, PrefixResolver namespaceContext)
          Given an string, init an XPath object for pattern matches, in order that a parse doesn't have to be done each time the expression is evaluated.
 void initXPath(XPath pathObj, java.lang.String expression, PrefixResolver namespaceContext)
          Given an string, init an XPath object for selections, in order that a parse doesn't have to be done each time the expression is evaluated.
protected  void Literal()
          The value of the Literal is the sequence of characters inside the " or ' characters>.
protected  void LocationPath()
          LocationPath ::= RelativeLocationPath | AbsoluteLocationPath
protected  void LocationPathPattern()
          LocationPathPattern ::= '/' RelativePathPattern? | IdKeyPattern (('/' | '//') RelativePathPattern)? | '//'? RelativePathPattern
protected  int MultiplicativeExpr(int addPos)
          XXXX.
protected  void NCName()
          NCName ::= (Letter | '_') (NCNameChar)* NCNameChar ::= Letter | Digit | '.' | '-' | '_' | CombiningChar | Extender
protected  void NodeTest(int axesType)
          NodeTest ::= WildcardName | NodeType '(' ')' | 'processing-instruction' '(' Literal ')'
protected  void Number()
          Number ::= [0-9]+('.'[0-9]+)? | '.'[0-9]+
protected  void NumberExpr()
          NumberExpr ::= Expr
protected  void OrExpr()
          OrExpr ::= AndExpr | OrExpr 'or' AndExpr
protected  void PathExpr()
          PathExpr ::= LocationPath | FilterExpr | FilterExpr '/' RelativeLocationPath | FilterExpr '//' RelativeLocationPath
protected  void Pattern()
          Pattern ::= LocationPathPattern | Pattern '|' LocationPathPattern
protected  void Predicate()
          Predicate ::= '[' PredicateExpr ']'
protected  void PredicateExpr()
          PredicateExpr ::= Expr
protected  void PrimaryExpr()
          PrimaryExpr ::= VariableReference | '(' Expr ')' | Literal | Number | FunctionCall
protected  void QName()
          QName ::= (Prefix ':')? LocalPart Prefix ::= NCName LocalPart ::= NCName
protected  int RelationalExpr(int addPos)
          .
protected  void RelativeLocationPath()
          RelativeLocationPath ::= Step | RelativeLocationPath '/' Step | AbbreviatedRelativeLocationPath
protected  void RelativePathPattern()
          RelativePathPattern ::= StepPattern | RelativePathPattern '/' StepPattern | RelativePathPattern '//' StepPattern
protected  void Step()
          Step ::= Basis Predicate* | AbbreviatedStep
protected  void StepPattern()
          StepPattern ::= AbbreviatedNodeTestStep
protected  void StringExpr()
          StringExpr ::= Expr
protected  void UnaryExpr()
          XXXX.
protected  void UnionExpr()
          The context of the right hand side expressions is the context of the left hand side expression.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XPathProcessorImpl

public XPathProcessorImpl(XPathSupport callbacks)
The parser constructor.
Parameters:
callbacks - The execution context.

XPathProcessorImpl

public XPathProcessorImpl()
The parser constructor. This constructor creates it's own XPathSupportDefault object, which is only useful for some limited cases.
Method Detail

initXPath

public void initXPath(XPath pathObj,
                      java.lang.String expression,
                      PrefixResolver namespaceContext)
               throws SAXException
Given an string, init an XPath object for selections, in order that a parse doesn't have to be done each time the expression is evaluated.
Specified by:
initXPath in interface XPathProcessor
Parameters:
pathObj - The XPath object to be initialized.
expresson - A String representing the XPath.
namespaceContext - An object that is able to resolve prefixes in the XPath to namespaces.

initMatchPattern

public void initMatchPattern(XPath pathObj,
                             java.lang.String expression,
                             PrefixResolver namespaceContext)
                      throws SAXException
Given an string, init an XPath object for pattern matches, in order that a parse doesn't have to be done each time the expression is evaluated.
Specified by:
initMatchPattern in interface XPathProcessor
Parameters:
pathObj - The XPath object to be initialized.
expresson - A String representing the XPath.
namespaceContext - An object that is able to resolve prefixes in the XPath to namespaces.

dumpRemainingTokenQueue

protected java.lang.String dumpRemainingTokenQueue()
Dump the remaining token queue. Thanks to Craig for this.

Expr

protected void Expr()
             throws SAXException
Expr ::= OrExpr

OrExpr

protected void OrExpr()
               throws SAXException
OrExpr ::= AndExpr | OrExpr 'or' AndExpr

AndExpr

protected void AndExpr()
                throws SAXException
AndExpr ::= EqualityExpr | AndExpr 'and' EqualityExpr

EqualityExpr

protected int EqualityExpr(int addPos)
                    throws SAXException

RelationalExpr

protected int RelationalExpr(int addPos)
                      throws SAXException
.

AdditiveExpr

protected int AdditiveExpr(int addPos)
                    throws SAXException
XXXX.
Parameters:
addPos - The position where the op should be inserted. AdditiveExpr ::= MultiplicativeExpr | AdditiveExpr '+' MultiplicativeExpr | AdditiveExpr '-' MultiplicativeExpr

MultiplicativeExpr

protected int MultiplicativeExpr(int addPos)
                          throws SAXException
XXXX.
Parameters:
addPos - The position where the op should be inserted. MultiplicativeExpr ::= UnaryExpr | MultiplicativeExpr MultiplyOperator UnaryExpr | MultiplicativeExpr 'div' UnaryExpr | MultiplicativeExpr 'mod' UnaryExpr | MultiplicativeExpr 'quo' UnaryExpr

UnaryExpr

protected void UnaryExpr()
                  throws SAXException
XXXX.

StringExpr

protected void StringExpr()
                   throws SAXException
StringExpr ::= Expr

BooleanExpr

protected void BooleanExpr()
                    throws SAXException
StringExpr ::= Expr

NumberExpr

protected void NumberExpr()
                   throws SAXException
NumberExpr ::= Expr

UnionExpr

protected void UnionExpr()
                  throws SAXException
The context of the right hand side expressions is the context of the left hand side expression. The results of the right hand side expressions are node sets. The result of the left hand side UnionExpr is the union of the results of the right hand side expressions. UnionExpr ::= PathExpr | UnionExpr '|' PathExpr

PathExpr

protected void PathExpr()
                 throws SAXException
PathExpr ::= LocationPath | FilterExpr | FilterExpr '/' RelativeLocationPath | FilterExpr '//' RelativeLocationPath
Throws:
XSLProcessorException - thrown if the active ProblemListener and XMLParserLiaison decide the error condition is severe enough to halt processing.

FilterExpr

protected void FilterExpr()
                   throws SAXException
FilterExpr ::= PrimaryExpr | FilterExpr Predicate
Throws:
XSLProcessorException - thrown if the active ProblemListener and XMLParserLiaison decide the error condition is severe enough to halt processing.

PrimaryExpr

protected void PrimaryExpr()
                    throws SAXException
PrimaryExpr ::= VariableReference | '(' Expr ')' | Literal | Number | FunctionCall

Argument

protected void Argument()
                 throws SAXException
Argument ::= Expr

FunctionCall

protected void FunctionCall()
                     throws SAXException
FunctionCall ::= FunctionName '(' ( Argument ( ',' Argument)*)? ')'

LocationPath

protected void LocationPath()
                     throws SAXException
LocationPath ::= RelativeLocationPath | AbsoluteLocationPath

RelativeLocationPath

protected void RelativeLocationPath()
                             throws SAXException
RelativeLocationPath ::= Step | RelativeLocationPath '/' Step | AbbreviatedRelativeLocationPath

Step

protected void Step()
             throws SAXException
Step ::= Basis Predicate* | AbbreviatedStep

Basis

protected void Basis()
              throws SAXException
Basis ::= AxisName '::' NodeTest | AbbreviatedBasis

AxisName

protected int AxisName()
                throws SAXException
Basis ::= AxisName '::' NodeTest | AbbreviatedBasis

NodeTest

protected void NodeTest(int axesType)
                 throws SAXException
NodeTest ::= WildcardName | NodeType '(' ')' | 'processing-instruction' '(' Literal ')'

Predicate

protected void Predicate()
                  throws SAXException
Predicate ::= '[' PredicateExpr ']'

PredicateExpr

protected void PredicateExpr()
                      throws SAXException
PredicateExpr ::= Expr

QName

protected void QName()
              throws SAXException
QName ::= (Prefix ':')? LocalPart Prefix ::= NCName LocalPart ::= NCName

NCName

protected void NCName()
NCName ::= (Letter | '_') (NCNameChar)* NCNameChar ::= Letter | Digit | '.' | '-' | '_' | CombiningChar | Extender

Literal

protected void Literal()
                throws SAXException
The value of the Literal is the sequence of characters inside the " or ' characters>. Literal ::= '"' [^"]* '"' | "'" [^']* "'"

Number

protected void Number()
               throws SAXException
Number ::= [0-9]+('.'[0-9]+)? | '.'[0-9]+

Pattern

protected void Pattern()
                throws SAXException
Pattern ::= LocationPathPattern | Pattern '|' LocationPathPattern

LocationPathPattern

protected void LocationPathPattern()
                            throws SAXException
LocationPathPattern ::= '/' RelativePathPattern? | IdKeyPattern (('/' | '//') RelativePathPattern)? | '//'? RelativePathPattern

IdKeyPattern

protected void IdKeyPattern()
                     throws SAXException
IdKeyPattern ::= 'id' '(' Literal ')' | 'key' '(' Literal ',' Literal ')' (Also handle doc())

RelativePathPattern

protected void RelativePathPattern()
                            throws SAXException
RelativePathPattern ::= StepPattern | RelativePathPattern '/' StepPattern | RelativePathPattern '//' StepPattern

StepPattern

protected void StepPattern()
                    throws SAXException
StepPattern ::= AbbreviatedNodeTestStep

AbbreviatedNodeTestStep

protected void AbbreviatedNodeTestStep()
                                throws SAXException
AbbreviatedNodeTestStep ::= '@'? NodeTest Predicate*

diagnoseXPathString

public static void diagnoseXPathString(java.lang.String str)
                                throws SAXException
Dump an XPath string to System.out.

diagnoseXPathString2

public static void diagnoseXPathString2(java.lang.String str)
                                 throws SAXException
Dump an XPath string to System.out.

diagnoseXPathString3

public static void diagnoseXPathString3(java.lang.String str)
                                 throws SAXException
Dump an XPath string to System.out.

Enhydra 3.1 API