|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.saxon.expr.ExpressionParser
public class ExpressionParser
Parser for XPath expressions and XSLT patterns. This code was originally inspired by James Clark's xt but has been totally rewritten (several times)
Nested Class Summary | |
---|---|
static class |
ExpressionParser.ForClause
|
Constructor Summary | |
---|---|
ExpressionParser()
Create an expression parser |
Method Summary | |
---|---|
Stack |
getRangeVariableStack()
Get the range variable stack. |
Tokenizer |
getTokenizer()
Get the tokenizer (the lexical analyzer) |
boolean |
isCompileWithTracing()
Determine whether trace hooks are included in the compiled code. |
LocalNameTest |
makeLocalNameTest(short nodeType,
String localName)
Make a LocalNameTest (*:name) |
int |
makeNameCode(String qname,
boolean useDefault)
Make a NameCode, using the static context for namespace resolution |
int |
makeNameCodeSilently(String qname,
boolean useDefault)
Make a NameCode, using the static context for namespace resolution. |
NamespaceTest |
makeNamespaceTest(short nodeType,
String prefix)
Make a NamespaceTest (name:*) |
NameTest |
makeNameTest(short nodeType,
String qname,
boolean useDefault)
Make a NameTest, using the static context for namespace resolution |
StructuredQName |
makeStructuredQName(String qname,
boolean useDefault)
Make a Structured QName, using the static context for namespace resolution |
Expression |
parse(String expression,
int start,
int terminator,
int lineNumber,
StaticContext env)
Parse a string representing an expression |
Pattern |
parsePattern(String pattern,
StaticContext env)
Parse a string representing an XSLT pattern |
SequenceType |
parseSequenceType(String input,
StaticContext env)
Parse a string representing a sequence type |
void |
setCompileWithTracing(boolean trueOrFalse)
Set whether trace hooks are to be included in the compiled code. |
void |
setRangeVariableStack(Stack stack)
Set the range variable stack. |
void |
setScanOnly(boolean scanOnly)
Set that we are parsing in "scan only" |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ExpressionParser()
Method Detail |
---|
public void setCompileWithTracing(boolean trueOrFalse)
trueOrFalse
- true if trace code is to be compiled in, false otherwisepublic boolean isCompileWithTracing()
public Tokenizer getTokenizer()
public Expression parse(String expression, int start, int terminator, int lineNumber, StaticContext env) throws XPathException
expression
- the expression expressed as a Stringstart
- offset within the string where parsing is to startterminator
- character to treat as terminating the expressionlineNumber
- location of the start of the expression, for diagnosticsenv
- the static context for the expression
XPathException
- if the expression contains a syntax errorpublic Pattern parsePattern(String pattern, StaticContext env) throws XPathException
pattern
- the pattern expressed as a Stringenv
- the static context for the pattern
XPathException
- if the pattern contains a syntax errorpublic SequenceType parseSequenceType(String input, StaticContext env) throws XPathException
input
- the string, which should conform to the XPath SequenceType
productionenv
- the static context
XPathException
- if any error is encounteredpublic Stack getRangeVariableStack()
public void setRangeVariableStack(Stack stack)
stack
- the stack to be used for local variables declared within the expressionpublic final int makeNameCode(String qname, boolean useDefault) throws XPathException
qname
- The name as written, in the form "[prefix:]localname"useDefault
- Defines the action when there is no prefix. If
true, use the default namespace URI for element names. If false,
use no namespace URI (as for attribute names).
XPathException
- if the name is invalid, or the prefix
undeclaredpublic final int makeNameCodeSilently(String qname, boolean useDefault) throws XPathException, QNameException
qname
- The name as written, in the form "[prefix:]localname"useDefault
- Defines the action when there is no prefix. If
true, use the default namespace URI for element names. If false,
use no namespace URI (as for attribute names).
XPathException
- if the name is invalid, or the prefix
undeclared
QNameException
public final StructuredQName makeStructuredQName(String qname, boolean useDefault) throws XPathException
qname
- The name as written, in the form "[prefix:]localname"useDefault
- Defines the action when there is no prefix. If
true, use the default namespace URI for element names. If false,
use no namespace URI (as for attribute names).
XPathException
- if the name is invalid, or the prefix
undeclaredpublic NameTest makeNameTest(short nodeType, String qname, boolean useDefault) throws XPathException
nodeType
- the type of node required (identified by a constant in
class Type)qname
- the lexical QName of the required nodeuseDefault
- true if the default namespace should be used when
the QName is unprefixed
XPathException
- if the QName is invalidpublic NamespaceTest makeNamespaceTest(short nodeType, String prefix) throws XPathException
nodeType
- integer code identifying the type of node requiredprefix
- the namespace prefix
XPathException
- if the namespace prefix is not declaredpublic LocalNameTest makeLocalNameTest(short nodeType, String localName) throws XPathException
nodeType
- the kind of node to be matchedlocalName
- the requred local name
XPathException
- if the local name is invalidpublic void setScanOnly(boolean scanOnly)
scanOnly
- true if parsing is to proceed in scan-only mode. In this mode
namespace bindings are not yet known, so no attempt is made to look up namespace
prefixes.
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |