BEA Systems, Inc.

WebLogic Server 6.0sp2 API Reference

weblogic.apache.xalan.xpath
Class XPathProcessorImpl

java.lang.Object
  |
  +--weblogic.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.

This class is based on an implementation from the Apache XML Project. In future releases the XML parser, XSLT processor, and associated classes will likely be updated to be based on a later version of the Apache implementations. Since Apache does not guarantee backwards compatibility between versions of their software, we cannot guarantee backwards compatibility of any of the classes contained in the weblogic.apache package or sub-packages.

Author:
Copyright © 2001 BEA Systems, Inc. All Rights Reserved.
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 org.xml.sax.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 org.xml.sax.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 org.xml.sax.SAXException
Expr ::= OrExpr


OrExpr

protected void OrExpr()
               throws org.xml.sax.SAXException
OrExpr ::= AndExpr | OrExpr 'or' AndExpr


AndExpr

protected void AndExpr()
                throws org.xml.sax.SAXException
AndExpr ::= EqualityExpr | AndExpr 'and' EqualityExpr


EqualityExpr

protected int EqualityExpr(int addPos)
                    throws org.xml.sax.SAXException


RelationalExpr

protected int RelationalExpr(int addPos)
                      throws org.xml.sax.SAXException
.


AdditiveExpr

protected int AdditiveExpr(int addPos)
                    throws org.xml.sax.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 org.xml.sax.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 org.xml.sax.SAXException
XXXX.


StringExpr

protected void StringExpr()
                   throws org.xml.sax.SAXException
StringExpr ::= Expr


BooleanExpr

protected void BooleanExpr()
                    throws org.xml.sax.SAXException
StringExpr ::= Expr


NumberExpr

protected void NumberExpr()
                   throws org.xml.sax.SAXException
NumberExpr ::= Expr


UnionExpr

protected void UnionExpr()
                  throws org.xml.sax.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 org.xml.sax.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 org.xml.sax.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 org.xml.sax.SAXException
PrimaryExpr ::= VariableReference | '(' Expr ')' | Literal | Number | FunctionCall


Argument

protected void Argument()
                 throws org.xml.sax.SAXException
Argument ::= Expr


FunctionCall

protected void FunctionCall()
                     throws org.xml.sax.SAXException
FunctionCall ::= FunctionName '(' ( Argument ( ',' Argument)*)? ')'


LocationPath

protected void LocationPath()
                     throws org.xml.sax.SAXException
LocationPath ::= RelativeLocationPath | AbsoluteLocationPath


RelativeLocationPath

protected void RelativeLocationPath()
                             throws org.xml.sax.SAXException
RelativeLocationPath ::= Step | RelativeLocationPath '/' Step | AbbreviatedRelativeLocationPath


Step

protected void Step()
             throws org.xml.sax.SAXException
Step ::= Basis Predicate* | AbbreviatedStep


Basis

protected void Basis()
              throws org.xml.sax.SAXException
Basis ::= AxisName '::' NodeTest | AbbreviatedBasis


AxisName

protected int AxisName()
                throws org.xml.sax.SAXException
Basis ::= AxisName '::' NodeTest | AbbreviatedBasis


NodeTest

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


Predicate

protected void Predicate()
                  throws org.xml.sax.SAXException
Predicate ::= '[' PredicateExpr ']'


PredicateExpr

protected void PredicateExpr()
                      throws org.xml.sax.SAXException
PredicateExpr ::= Expr


QName

protected void QName()
              throws org.xml.sax.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 org.xml.sax.SAXException
The value of the Literal is the sequence of characters inside the " or ' characters>. Literal ::= '"' [^"]* '"' | "'" [^']* "'"


Number

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


Pattern

protected void Pattern()
                throws org.xml.sax.SAXException
Pattern ::= LocationPathPattern | Pattern '|' LocationPathPattern


LocationPathPattern

protected void LocationPathPattern()
                            throws org.xml.sax.SAXException
LocationPathPattern ::= '/' RelativePathPattern? | IdKeyPattern (('/' | '//') RelativePathPattern)? | '//'? RelativePathPattern


IdKeyPattern

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


RelativePathPattern

protected void RelativePathPattern()
                            throws org.xml.sax.SAXException
RelativePathPattern ::= StepPattern | RelativePathPattern '/' StepPattern | RelativePathPattern '//' StepPattern


StepPattern

protected void StepPattern()
                    throws org.xml.sax.SAXException
StepPattern ::= AbbreviatedNodeTestStep


AbbreviatedNodeTestStep

protected void AbbreviatedNodeTestStep()
                                throws org.xml.sax.SAXException
AbbreviatedNodeTestStep ::= '@'? NodeTest Predicate*


diagnoseXPathString

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


diagnoseXPathString2

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


diagnoseXPathString3

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


Documentation is available at
http://download.oracle.com/docs/cd/E13222_01/wls/docs60