Package org.apache.xpath.compiler
Class XPathParser
- java.lang.Object
-
- org.apache.xpath.compiler.XPathParser
-
public class XPathParser extends java.lang.Object
Tokenizes and parses XPath expressions. This should really be named XPathParserImpl, and may be renamed in the future.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
CONTINUE_AFTER_FATAL_ERROR
-
Constructor Summary
Constructors Constructor Description XPathParser(javax.xml.transform.ErrorListener errorListener, javax.xml.transform.SourceLocator sourceLocator)
The parser constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description javax.xml.transform.ErrorListener
getErrorListener()
Return the current error listener.void
initMatchPattern(Compiler compiler, 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(Compiler compiler, 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.void
setErrorHandler(javax.xml.transform.ErrorListener handler)
Allow an application to register an error event handler, where syntax errors will be sent.
-
-
-
Field Detail
-
CONTINUE_AFTER_FATAL_ERROR
public static final java.lang.String CONTINUE_AFTER_FATAL_ERROR
- See Also:
- Constant Field Values
-
-
Method Detail
-
initXPath
public void initXPath(Compiler compiler, java.lang.String expression, PrefixResolver namespaceContext) throws javax.xml.transform.TransformerException
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.expression
- A string conforming to the XPath grammar.namespaceContext
- An object that is able to resolve prefixes in the XPath to namespaces.- Throws:
javax.xml.transform.TransformerException
-
initMatchPattern
public void initMatchPattern(Compiler compiler, java.lang.String expression, PrefixResolver namespaceContext) throws javax.xml.transform.TransformerException
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.expression
- A String representing the XPath.namespaceContext
- An object that is able to resolve prefixes in the XPath to namespaces.- Throws:
javax.xml.transform.TransformerException
-
setErrorHandler
public void setErrorHandler(javax.xml.transform.ErrorListener handler)
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.
-
getErrorListener
public javax.xml.transform.ErrorListener getErrorListener()
Return the current error listener.- Returns:
- The error listener, which should not normally be null, but may be.
-
-