Java Doc for XPathParser.java in  » XML » xalan » org » apache » xpath » compiler » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » XML » xalan » org.apache.xpath.compiler 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.xpath.compiler.XPathParser

XPathParser
public class XPathParser (Code)
Tokenizes and parses XPath expressions. This should really be named XPathParserImpl, and may be renamed in the future.


Field Summary
final public static  StringCONTINUE_AFTER_FATAL_ERROR
    
final protected static  intFILTER_MATCH_FAILED
    
final protected static  intFILTER_MATCH_PREDICATES
    
final protected static  intFILTER_MATCH_PRIMARY
    
 PrefixResolverm_namespaceContext
     The prefix resolver to map prefixes to namespaces in the OpMap.
 intm_queueMark
     The position in the token queue is tracked by m_queueMark.
 javax.xml.transform.SourceLocatorm_sourceLocator
     The source location of the XPath.
transient  Stringm_token
     The next token in the pattern.
transient  charm_tokenChar
     The first char in m_token, the theory being that this is an optimization because we won't have to do charAt(0) as often.

Constructor Summary
public  XPathParser(ErrorListener errorListener, javax.xml.transform.SourceLocator sourceLocator)
     The parser constructor.

Method Summary
protected  booleanAbbreviatedNodeTestStep(boolean isLeadingSlashPermitted)
    
protected  intAdditiveExpr(int addPos)
     This has to handle construction of the operations so that they are evaluated in pre-fix order.
protected  voidAndExpr()
    
protected  voidArgument()
    
protected  intAxisName()
    
protected  voidBasis()
    
protected  voidBooleanExpr()
    
protected  intEqualityExpr(int addPos)
    
Parameters:
  addPos - Position where expression is to be added, or -1 for append.
protected  voidExpr()
    
protected  intFilterExpr()
     FilterExpr ::= PrimaryExpr | FilterExpr Predicate
throws:
  XSLProcessorException - thrown if the active ProblemListener and XPathContext decidethe error condition is severe enough to halt processing.
protected  booleanFunctionCall()
    
protected  voidIdKeyPattern()
    
protected  voidLiteral()
     The value of the Literal is the sequence of characters inside the " or ' characters>.
protected  voidLocationPath()
    
protected  voidLocationPathPattern()
    
protected  intMultiplicativeExpr(int addPos)
     This has to handle construction of the operations so that they are evaluated in pre-fix order.
protected  voidNCName()
    
protected  voidNodeTest(int axesType)
    
protected  voidNumber()
    
protected  voidNumberExpr()
    
protected  voidOrExpr()
    
protected  voidPathExpr()
    
protected  voidPattern()
    
protected  voidPredicate()
    
protected  voidPredicateExpr()
    
protected  booleanPrimaryExpr()
    
protected  voidQName()
    
protected  intRelationalExpr(int addPos)
     .
Parameters:
  addPos - Position where expression is to be added, or -1 for append.
protected  booleanRelativeLocationPath()
    
protected  voidRelativePathPattern()
    
protected  booleanStep()
    
protected  booleanStepPattern(boolean isLeadingSlashPermitted)
    
protected  voidStringExpr()
    
protected  voidUnaryExpr()
    
protected  voidUnionExpr()
     The context of the right hand side expressions is the context of the left hand side expression.
 voidappendOp(int length, int op)
     Insert room for operation.
protected  StringdumpRemainingTokenQueue()
     Dump the remaining token queue.
 voiderror(String msg, Object[] args)
     Notify the user of an error, and probably throw an exception.
 voiderrorForDOM3(String msg, Object[] args)
     This method is added to support DOM 3 XPath API.

This method is exactly like error(String, Object[]); except that the underlying TransformerException is XpathStylesheetDOM3Exception (which extends TransformerException).

So older XPath code in Xalan is not affected by this.

public  ErrorListenergetErrorListener()
     Return the current error listener.
final  intgetFunctionToken(String key)
     Given a string, return the corresponding function token.
Parameters:
  key - A local name of a function.
public  voidinitMatchPattern(Compiler compiler, 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.
public  voidinitXPath(Compiler compiler, 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.
 voidinsertOp(int pos, int length, int op)
     Insert room for operation.
final  booleanlookahead(char c, int n)
     Look ahead of the current token in order to make a branching decision.
Parameters:
  c - the character to be tested for.
Parameters:
  n - number of tokens to look ahead.
public  voidsetErrorHandler(ErrorListener handler)
     Allow an application to register an error event handler, where syntax errors will be sent.
final  booleantokenIs(String s)
     Check whether m_token matches the target string.
final  booleantokenIs(char c)
     Check whether m_tokenChar==c.
 voidwarn(String msg, Object[] args)
     Warn the user of a problem.

Field Detail
CONTINUE_AFTER_FATAL_ERROR
final public static String CONTINUE_AFTER_FATAL_ERROR(Code)



FILTER_MATCH_FAILED
final protected static int FILTER_MATCH_FAILED(Code)
Results from checking FilterExpr syntax



FILTER_MATCH_PREDICATES
final protected static int FILTER_MATCH_PREDICATES(Code)



FILTER_MATCH_PRIMARY
final protected static int FILTER_MATCH_PRIMARY(Code)



m_namespaceContext
PrefixResolver m_namespaceContext(Code)
The prefix resolver to map prefixes to namespaces in the OpMap.



m_queueMark
int m_queueMark(Code)
The position in the token queue is tracked by m_queueMark.



m_sourceLocator
javax.xml.transform.SourceLocator m_sourceLocator(Code)
The source location of the XPath.



m_token
transient String m_token(Code)
The next token in the pattern.



m_tokenChar
transient char m_tokenChar(Code)
The first char in m_token, the theory being that this is an optimization because we won't have to do charAt(0) as often.




Constructor Detail
XPathParser
public XPathParser(ErrorListener errorListener, javax.xml.transform.SourceLocator sourceLocator)(Code)
The parser constructor.




Method Detail
AbbreviatedNodeTestStep
protected boolean AbbreviatedNodeTestStep(boolean isLeadingSlashPermitted) throws javax.xml.transform.TransformerException(Code)
AbbreviatedNodeTestStep ::= '@'? NodeTest Predicate
Parameters:
  isLeadingSlashPermitted - a boolean indicating whether a slash canappear at the start of this step boolean indicating whether a slash following the step was consumed
throws:
  javax.xml.transform.TransformerException -



AdditiveExpr
protected int AdditiveExpr(int addPos) throws javax.xml.transform.TransformerException(Code)
This has to handle construction of the operations so that they are evaluated in pre-fix order. So, for 9+7-6, instead of |+|9|-|7|6|, this needs to be evaluated as |-|+|9|7|6|. AdditiveExpr ::= MultiplicativeExpr | AdditiveExpr '+' MultiplicativeExpr | AdditiveExpr '-' MultiplicativeExpr
Parameters:
  addPos - Position where expression is to be added, or -1 for append. the position at the end of the equality expression.
throws:
  javax.xml.transform.TransformerException -



AndExpr
protected void AndExpr() throws javax.xml.transform.TransformerException(Code)
AndExpr ::= EqualityExpr | AndExpr 'and' EqualityExpr
throws:
  javax.xml.transform.TransformerException -



Argument
protected void Argument() throws javax.xml.transform.TransformerException(Code)
Argument ::= Expr
throws:
  javax.xml.transform.TransformerException -



AxisName
protected int AxisName() throws javax.xml.transform.TransformerException(Code)
Basis ::= AxisName '::' NodeTest | AbbreviatedBasis FROM_XXX axes type, found in org.apache.xpath.compiler.Keywords.
throws:
  javax.xml.transform.TransformerException -



Basis
protected void Basis() throws javax.xml.transform.TransformerException(Code)
Basis ::= AxisName '::' NodeTest | AbbreviatedBasis
throws:
  javax.xml.transform.TransformerException -



BooleanExpr
protected void BooleanExpr() throws javax.xml.transform.TransformerException(Code)
StringExpr ::= Expr
throws:
  javax.xml.transform.TransformerException -



EqualityExpr
protected int EqualityExpr(int addPos) throws javax.xml.transform.TransformerException(Code)

Parameters:
  addPos - Position where expression is to be added, or -1 for append. the position at the end of the equality expression.
throws:
  javax.xml.transform.TransformerException -



Expr
protected void Expr() throws javax.xml.transform.TransformerException(Code)
Expr ::= OrExpr
throws:
  javax.xml.transform.TransformerException -



FilterExpr
protected int FilterExpr() throws javax.xml.transform.TransformerException(Code)
FilterExpr ::= PrimaryExpr | FilterExpr Predicate
throws:
  XSLProcessorException - thrown if the active ProblemListener and XPathContext decidethe error condition is severe enough to halt processing. FILTER_MATCH_PREDICATES, if this method successfully matched aFilterExpr with one or more Predicates;FILTER_MATCH_PRIMARY, if this method successfully matched aFilterExpr that was just a PrimaryExpr; orFILTER_MATCH_FAILED, if this method did not match a FilterExpr
throws:
  javax.xml.transform.TransformerException -



FunctionCall
protected boolean FunctionCall() throws javax.xml.transform.TransformerException(Code)
FunctionCall ::= FunctionName '(' ( Argument ( ',' Argument)*)? ')' true if, and only if, a FunctionCall was matched
throws:
  javax.xml.transform.TransformerException -



IdKeyPattern
protected void IdKeyPattern() throws javax.xml.transform.TransformerException(Code)
IdKeyPattern ::= 'id' '(' Literal ')' | 'key' '(' Literal ',' Literal ')' (Also handle doc())
throws:
  javax.xml.transform.TransformerException -



Literal
protected void Literal() throws javax.xml.transform.TransformerException(Code)
The value of the Literal is the sequence of characters inside the " or ' characters>. Literal ::= '"' [^"]* '"' | "'" [^']* "'"
throws:
  javax.xml.transform.TransformerException -



LocationPath
protected void LocationPath() throws javax.xml.transform.TransformerException(Code)
LocationPath ::= RelativeLocationPath | AbsoluteLocationPath
throws:
  javax.xml.transform.TransformerException -



LocationPathPattern
protected void LocationPathPattern() throws javax.xml.transform.TransformerException(Code)
LocationPathPattern ::= '/' RelativePathPattern? | IdKeyPattern (('/' | '//') RelativePathPattern)? | '//'? RelativePathPattern
throws:
  javax.xml.transform.TransformerException -



MultiplicativeExpr
protected int MultiplicativeExpr(int addPos) throws javax.xml.transform.TransformerException(Code)
This has to handle construction of the operations so that they are evaluated in pre-fix order. So, for 9+7-6, instead of |+|9|-|7|6|, this needs to be evaluated as |-|+|9|7|6|. MultiplicativeExpr ::= UnaryExpr | MultiplicativeExpr MultiplyOperator UnaryExpr | MultiplicativeExpr 'div' UnaryExpr | MultiplicativeExpr 'mod' UnaryExpr | MultiplicativeExpr 'quo' UnaryExpr
Parameters:
  addPos - Position where expression is to be added, or -1 for append. the position at the end of the equality expression.
throws:
  javax.xml.transform.TransformerException -



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



NodeTest
protected void NodeTest(int axesType) throws javax.xml.transform.TransformerException(Code)
NodeTest ::= WildcardName | NodeType '(' ')' | 'processing-instruction' '(' Literal ')'
Parameters:
  axesType - FROM_XXX axes type, found in org.apache.xpath.compiler.Keywords.
throws:
  javax.xml.transform.TransformerException -



Number
protected void Number() throws javax.xml.transform.TransformerException(Code)
Number ::= [0-9]+('.'[0-9]+)? | '.'[0-9]+
throws:
  javax.xml.transform.TransformerException -



NumberExpr
protected void NumberExpr() throws javax.xml.transform.TransformerException(Code)
NumberExpr ::= Expr
throws:
  javax.xml.transform.TransformerException -



OrExpr
protected void OrExpr() throws javax.xml.transform.TransformerException(Code)
OrExpr ::= AndExpr | OrExpr 'or' AndExpr
throws:
  javax.xml.transform.TransformerException -



PathExpr
protected void PathExpr() throws javax.xml.transform.TransformerException(Code)
PathExpr ::= LocationPath | FilterExpr | FilterExpr '/' RelativeLocationPath | FilterExpr '//' RelativeLocationPath
throws:
  XSLProcessorException - thrown if the active ProblemListener and XPathContext decidethe error condition is severe enough to halt processing.
throws:
  javax.xml.transform.TransformerException -



Pattern
protected void Pattern() throws javax.xml.transform.TransformerException(Code)
Pattern ::= LocationPathPattern | Pattern '|' LocationPathPattern
throws:
  javax.xml.transform.TransformerException -



Predicate
protected void Predicate() throws javax.xml.transform.TransformerException(Code)
Predicate ::= '[' PredicateExpr ']'
throws:
  javax.xml.transform.TransformerException -



PredicateExpr
protected void PredicateExpr() throws javax.xml.transform.TransformerException(Code)
PredicateExpr ::= Expr
throws:
  javax.xml.transform.TransformerException -



PrimaryExpr
protected boolean PrimaryExpr() throws javax.xml.transform.TransformerException(Code)
PrimaryExpr ::= VariableReference | '(' Expr ')' | Literal | Number | FunctionCall true if this method successfully matched a PrimaryExpr
throws:
  javax.xml.transform.TransformerException -



QName
protected void QName() throws javax.xml.transform.TransformerException(Code)
QName ::= (Prefix ':')? LocalPart Prefix ::= NCName LocalPart ::= NCName
throws:
  javax.xml.transform.TransformerException -



RelationalExpr
protected int RelationalExpr(int addPos) throws javax.xml.transform.TransformerException(Code)
.
Parameters:
  addPos - Position where expression is to be added, or -1 for append. the position at the end of the relational expression.
throws:
  javax.xml.transform.TransformerException -



RelativeLocationPath
protected boolean RelativeLocationPath() throws javax.xml.transform.TransformerException(Code)
RelativeLocationPath ::= Step | RelativeLocationPath '/' Step | AbbreviatedRelativeLocationPath
throws:
  javax.xml.transform.TransformerException -



RelativePathPattern
protected void RelativePathPattern() throws javax.xml.transform.TransformerException(Code)
RelativePathPattern ::= StepPattern | RelativePathPattern '/' StepPattern | RelativePathPattern '//' StepPattern
throws:
  javax.xml.transform.TransformerException -



Step
protected boolean Step() throws javax.xml.transform.TransformerException(Code)
Step ::= Basis Predicate | AbbreviatedStep
throws:
  javax.xml.transform.TransformerException -



StepPattern
protected boolean StepPattern(boolean isLeadingSlashPermitted) throws javax.xml.transform.TransformerException(Code)
StepPattern ::= AbbreviatedNodeTestStep
Parameters:
  isLeadingSlashPermitted - a boolean indicating whether a slash canappear at the start of this step boolean indicating whether a slash following the step was consumed
throws:
  javax.xml.transform.TransformerException -



StringExpr
protected void StringExpr() throws javax.xml.transform.TransformerException(Code)
StringExpr ::= Expr
throws:
  javax.xml.transform.TransformerException -



UnaryExpr
protected void UnaryExpr() throws javax.xml.transform.TransformerException(Code)
UnaryExpr ::= UnionExpr | '-' UnaryExpr
throws:
  javax.xml.transform.TransformerException -



UnionExpr
protected void UnionExpr() throws javax.xml.transform.TransformerException(Code)
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
throws:
  javax.xml.transform.TransformerException -



appendOp
void appendOp(int length, int op)(Code)
Insert room for operation. This WILL set the length value of the operation, and will update the length value for the total expression.
Parameters:
  length - The length of the operation.
Parameters:
  op - The op code to the inserted.



dumpRemainingTokenQueue
protected String dumpRemainingTokenQueue()(Code)
Dump the remaining token queue. Thanks to Craig for this. A dump of the remaining token queue, which may be appended to an error message.



error
void error(String msg, Object[] args) throws TransformerException(Code)
Notify the user of an error, and probably throw an exception.
Parameters:
  msg - An error msgkey that corresponds to one of the constants found in org.apache.xpath.res.XPATHErrorResources, which is a key for a format string.
Parameters:
  args - An array of arguments represented in the format string, which may be null.
throws:
  TransformerException - if the current ErrorListoner determines to throw an exception.



errorForDOM3
void errorForDOM3(String msg, Object[] args) throws TransformerException(Code)
This method is added to support DOM 3 XPath API.

This method is exactly like error(String, Object[]); except that the underlying TransformerException is XpathStylesheetDOM3Exception (which extends TransformerException).

So older XPath code in Xalan is not affected by this. To older XPath code the behavior of whether error() or errorForDOM3() is called because it is always catching TransformerException objects and is oblivious to the new subclass of XPathStylesheetDOM3Exception. Older XPath code runs as before.

However, newer DOM3 XPath code upon catching a TransformerException can can check if the exception is an instance of XPathStylesheetDOM3Exception and take appropriate action.
Parameters:
  msg - An error msgkey that corresponds to one of the constants found in org.apache.xpath.res.XPATHErrorResources, which is a key for a format string.
Parameters:
  args - An array of arguments represented in the format string, which may be null.
throws:
  TransformerException - if the current ErrorListoner determines to throw an exception.




getErrorListener
public ErrorListener getErrorListener()(Code)
Return the current error listener. The error listener, which should not normally be null, but may be.



getFunctionToken
final int getFunctionToken(String key)(Code)
Given a string, return the corresponding function token.
Parameters:
  key - A local name of a function. The function ID, which may correspond to one of the FUNC_XXX values found in org.apache.xpath.compiler.FunctionTable, but may be a value installed by an external module.



initMatchPattern
public void initMatchPattern(Compiler compiler, String expression, PrefixResolver namespaceContext) throws javax.xml.transform.TransformerException(Code)
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.
Parameters:
  compiler - The XPath object to be initialized.
Parameters:
  expression - A String representing the XPath.
Parameters:
  namespaceContext - An object that is able to resolve prefixes inthe XPath to namespaces.
throws:
  javax.xml.transform.TransformerException -



initXPath
public void initXPath(Compiler compiler, String expression, PrefixResolver namespaceContext) throws javax.xml.transform.TransformerException(Code)
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.
Parameters:
  compiler - The compiler object.
Parameters:
  expression - A string conforming to the XPath grammar.
Parameters:
  namespaceContext - An object that is able to resolve prefixes inthe XPath to namespaces.
throws:
  javax.xml.transform.TransformerException -



insertOp
void insertOp(int pos, int length, int op)(Code)
Insert room for operation. This will NOT set the length value of the operation, but will update the length value for the total expression.
Parameters:
  pos - The position where the op is to be inserted.
Parameters:
  length - The length of the operation space in the op map.
Parameters:
  op - The op code to the inserted.



lookahead
final boolean lookahead(char c, int n)(Code)
Look ahead of the current token in order to make a branching decision.
Parameters:
  c - the character to be tested for.
Parameters:
  n - number of tokens to look ahead. Must begreater than 1. true if the next token matches the character argument.



setErrorHandler
public void setErrorHandler(ErrorListener handler)(Code)
Allow an application to register an error event handler, where syntax errors will be sent. If the error listener is not set, syntax errors will be sent to System.err.
Parameters:
  handler - Reference to error listener where syntax errors will be sent.



tokenIs
final boolean tokenIs(String s)(Code)
Check whether m_token matches the target string.
Parameters:
  s - A string reference or null. If m_token is null, returns false (or true if s is also null), or return true if the current token matches the string, else false.



tokenIs
final boolean tokenIs(char c)(Code)
Check whether m_tokenChar==c.
Parameters:
  c - A character to be tested. If m_token is null, returns false, or return true if c matches the current token.



warn
void warn(String msg, Object[] args) throws TransformerException(Code)
Warn the user of a problem.
Parameters:
  msg - An error msgkey that corresponds to one of the constants found in org.apache.xpath.res.XPATHErrorResources, which is a key for a format string.
Parameters:
  args - An array of arguments represented in the format string, which may be null.
throws:
  TransformerException - if the current ErrorListoner determines to throw an exception.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.