|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.saxon.query.StaticQueryContext
StaticQueryContext is the implementation of StaticContext used when processing XQuery expressions. Note that some of the methods are intended for use internally by the query processor itself.
Nested Class Summary | |
static class |
StaticQueryContext.ActiveNamespace
Inner class containing information about an active namespace entry |
Constructor Summary | |
StaticQueryContext(Configuration config)
Create a StaticQueryContext using the default NamePool |
Method Summary | |
void |
addImportedSchema(java.lang.String targetNamespace)
Add an imported schema to this static context. |
void |
allocateLocalSlots(int n)
Ensure that enough slots are available in each stack frame for local variables. |
Expression |
bindFunction(java.lang.String qname,
Expression[] arguments)
Identify a (namespace-prefixed) function appearing in the expression. |
protected void |
bindUnboundFunctionCalls()
Bind function calls that could not be bound when first encountered. |
VariableDeclaration |
bindVariable(int fingerprint)
Bind a variable used in a query to the expression in which it is declared. |
java.lang.String |
checkURIForPrefix(java.lang.String prefix)
Get the URI for a prefix if there is one, return null if not. |
void |
clearNamespaces()
Clear all the declared namespaces, except for the standard ones (xml, saxon, etc) |
protected void |
declareActiveNamespace(java.lang.String prefix,
java.lang.String uri)
Declare an active namespace |
void |
declareCollation(java.lang.String name,
java.util.Comparator comparator)
Declare a named collation. |
void |
declareDefaultCollation(java.lang.String name)
Set the default collation. |
void |
declareFunction(XQueryFunction function)
Register a user-defined XQuery function |
protected void |
declarePassiveNamespace(java.lang.String prefix,
java.lang.String uri)
Declare a namespace whose prefix can be used in expressions. |
void |
declareVariable(VariableDeclaration var)
Declare a global variable. |
void |
explainGlobalFunctions()
Output "explain" information about each declared function |
protected void |
fixupGlobalFunctions()
Fixup all references to global functions. |
void |
fixupGlobalVariables()
Fixup all references to global variables. |
int[] |
getActiveNamespaceCodes()
Get an array containing the namespace codes of all active namespaces. |
java.util.HashMap |
getAllCollations()
Get a HashMap that maps all registered collations to Comparators. |
java.lang.String |
getBaseURI()
Get the Base URI of the query, for resolving any relative URI's used in the expression. |
java.util.Comparator |
getCollation(java.lang.String name)
Get a named collation. |
Configuration |
getConfiguration()
Get the system configuration |
java.lang.String |
getDefaultCollationName()
Get the name of the default collation. |
short |
getDefaultElementNamespace()
Get the default XPath namespace, as a namespace URI code that can be looked up in the NamePool |
java.lang.String |
getDefaultFunctionNamespace()
Get the default function namespace |
java.util.Iterator |
getFunctionDefinitions()
Get an iterator over the Functions defined in this module |
int |
getLineNumber()
Get the line number of the expression within that container. |
java.lang.String |
getModuleNamespace()
Get the namespace of the current library module. |
short |
getModuleNamespaceCode()
Get the namesapce code of the current library module. |
NamePool |
getNamePool()
Get the NamePool used for compiling expressions |
NamespaceResolver |
getNamespaceContext()
Get a copy of the Namespace Context. |
int |
getNumberOfGlobalVariables()
Get the number of global variables. |
int |
getNumberOfLocalVariables()
Get the maximum number of local variables in any stack frame. |
java.lang.String |
getSystemId()
Get the system ID of the container of the expression. |
java.lang.String |
getURIForPrefix(java.lang.String prefix)
Get the URI for a prefix. |
ValidationContext |
getValidationContext()
Get the current validation context |
int |
getValidationMode()
Get the current validation mode |
java.util.Iterator |
getVariableDeclarations()
Get an iterator over the variables defined in this module |
boolean |
isImportedSchema(java.lang.String namespace)
Get the schema for a given namespace, if it has been imported |
boolean |
isInBackwardsCompatibleMode()
Determine whether Backwards Compatible Mode is used |
void |
issueWarning(java.lang.String s)
Issue a compile-time warning. |
protected StaticQueryContext |
loadModule(java.lang.String namespaceURI,
java.lang.String locationURI)
Load another query module |
void |
popValidationContext()
Remove the validation context currently at the top of the stack |
void |
popValidationMode()
Remove the validation mode currently at the top of the stack |
void |
pushValidationContext(ValidationContext context)
Add a new validation context to the stack of validation contexts |
void |
pushValidationMode(int mode)
Add a new validation mode to the stack of validation modes |
void |
reset()
Reset the state of this StaticQueryContext to an uninitialized state |
void |
setBaseURI(java.lang.String baseURI)
Set the Base URI of the query |
void |
setConfiguration(Configuration config)
Set the Configuration options |
void |
setContainedValidationContext(int fingerprint)
Set the validation context to a local element declaration within the current validation context |
protected void |
setDefaultElementNamespace(java.lang.String uri)
Set the default element namespace |
void |
setDefaultFunctionNamespace(java.lang.String defaultFunctionNamespace)
Set the default function namespace |
void |
setModuleNamespace(java.lang.String uri)
Set the namespace for a library module |
void |
undeclareNamespace()
Undeclare the most recently-declared active namespace |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public StaticQueryContext(Configuration config)
Method Detail |
public void reset()
public void setConfiguration(Configuration config)
public Configuration getConfiguration()
StaticContext
getConfiguration
in interface StaticContext
protected void declarePassiveNamespace(java.lang.String prefix, java.lang.String uri)
prefix
- The namespace prefix. Must not be null.uri
- The namespace URI. Must not be null.protected void declareActiveNamespace(java.lang.String prefix, java.lang.String uri)
public void undeclareNamespace()
public void clearNamespaces()
public java.lang.String getURIForPrefix(java.lang.String prefix) throws XPathException
getURIForPrefix
in interface StaticContext
prefix
- The prefix
XPathException
- if the prefix has not been declaredpublic java.lang.String checkURIForPrefix(java.lang.String prefix)
prefix
- The prefix
public int[] getActiveNamespaceCodes()
public NamespaceResolver getNamespaceContext()
public java.lang.String getDefaultFunctionNamespace()
public void setDefaultFunctionNamespace(java.lang.String defaultFunctionNamespace)
defaultFunctionNamespace
- The namespace to be used for unprefixed function callsprotected void setDefaultElementNamespace(java.lang.String uri)
public short getDefaultElementNamespace()
getDefaultElementNamespace
in interface StaticContext
public void setModuleNamespace(java.lang.String uri)
public java.lang.String getModuleNamespace()
public short getModuleNamespaceCode()
public void declareCollation(java.lang.String name, java.util.Comparator comparator)
name
- The name of the collation (technically, a URI)comparator
- The Java Comparator used to implement the collating sequencepublic void declareDefaultCollation(java.lang.String name) throws XPathException
name
- The collation name
XPathException
- if the collation name has not been registeredpublic java.util.Comparator getCollation(java.lang.String name)
getCollation
in interface StaticContext
name
- The name of the required collation. Supply null to get the default collation.
public java.lang.String getDefaultCollationName()
getDefaultCollationName
in interface StaticContext
public java.util.HashMap getAllCollations()
public void declareVariable(VariableDeclaration var) throws XPathException
XPathException
public void fixupGlobalVariables() throws XPathException
XPathException
public java.util.Iterator getVariableDeclarations()
public int getNumberOfGlobalVariables()
public void allocateLocalSlots(int n)
public int getNumberOfLocalVariables()
public NamePool getNamePool()
getNamePool
in interface StaticContext
public void issueWarning(java.lang.String s)
issueWarning
in interface StaticContext
public void setBaseURI(java.lang.String baseURI)
public java.lang.String getSystemId()
getSystemId
in interface StaticContext
public java.lang.String getBaseURI()
getBaseURI
in interface StaticContext
public int getLineNumber()
getLineNumber
in interface StaticContext
public VariableDeclaration bindVariable(int fingerprint) throws XPathException
bindVariable
in interface StaticContext
XPathException
public void declareFunction(XQueryFunction function) throws XPathException
XPathException
public Expression bindFunction(java.lang.String qname, Expression[] arguments) throws XPathException
Note that a function call may appear earlier in the query than the definition of the function to which it is bound. Unlike XSLT, we cannot search forwards to find the function definition. Binding of function calls is therefore a two-stage process; at the time the function call is parsed, we simply register it as pending; subsequently at the end of query parsing all the pending function calls are resolved. Another consequence of this is that we cannot tell at the time a function call is parsed whether it is a call to an internal (XSLT or XQuery) function or to an extension function written in Java.
bindFunction
in interface StaticContext
XPathException
- if the function call is invalid, either because it is
an unprefixed call to a non-system function, or because it is calling a system
function that is available in XSLT only. A prefixed function call that cannot
be recognized at this stage is assumed to be a forwards reference, and is bound
later when bindUnboundFunctionCalls() is called.protected void bindUnboundFunctionCalls() throws XPathException
XPathException
- if a function call refers to a function that has
not been declaredpublic java.util.Iterator getFunctionDefinitions()
protected void fixupGlobalFunctions() throws XPathException
This method is for internal use.
XPathException
public void explainGlobalFunctions() throws XPathException
XPathException
public boolean isInBackwardsCompatibleMode()
isInBackwardsCompatibleMode
in interface StaticContext
public void addImportedSchema(java.lang.String targetNamespace)
targetNamespace
- The target namespace of the schema to be addedpublic boolean isImportedSchema(java.lang.String namespace)
isImportedSchema
in interface StaticContext
namespace
- The namespace of the required schema. Supply "" for
a no-namespace schema.
public void pushValidationMode(int mode)
public void popValidationMode()
public int getValidationMode()
public void pushValidationContext(ValidationContext context)
public void popValidationContext()
public ValidationContext getValidationContext()
public void setContainedValidationContext(int fingerprint) throws XPathException
XPathException
protected StaticQueryContext loadModule(java.lang.String namespaceURI, java.lang.String locationURI) throws XPathException
XPathException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |