public abstract class AbstractStaticContext extends java.lang.Object implements StaticContext
This class implements those parts of the functionality of a static context that tend to be common to most implementations: simple-valued properties such as base URI and default element namespace; availability of the standard function library; and support for collations.
Modifier and Type | Field and Description |
---|---|
protected boolean |
usingDefaultFunctionLibrary |
Constructor and Description |
---|
AbstractStaticContext() |
Modifier and Type | Method and Description |
---|---|
protected void |
addFunctionLibrary(FunctionLibrary library)
Add a function library to the list of function libraries
|
Configuration |
getConfiguration()
Get the system configuration
|
Location |
getContainingLocation()
Get the containing location.
|
DecimalFormatManager |
getDecimalFormatManager()
Get a DecimalFormatManager to resolve the names of decimal formats used in calls
to the format-number() function.
|
java.lang.String |
getDefaultCollationName()
Get the name of the default collation.
|
java.lang.String |
getDefaultElementNamespace()
Get the default namespace URI for elements and types
Return NamespaceConstant.NULL (that is, the zero-length string) for the non-namespace
|
java.lang.String |
getDefaultFunctionNamespace()
Get the default function namespace.
|
FunctionLibrary |
getFunctionLibrary()
Get the function library containing all the in-scope functions available in this static
context.
|
KeyManager |
getKeyManager()
Get the KeyManager, containing definitions of keys available for use.
|
PackageData |
getPackageData()
Get data about the unit of compilation (XQuery module, XSLT package) to which this
container belongs
|
ItemType |
getRequiredContextItemType()
Get the required type of the context item.
|
java.lang.String |
getStaticBaseURI()
Get the Base URI, for resolving any relative URI's used
in the expression.
|
java.lang.String |
getSystemId()
Get the system ID of the container of the expression.
|
UnprefixedElementMatchingPolicy |
getUnprefixedElementMatchingPolicy()
Get the policy for matching unprefixed element names.
|
java.util.function.BiConsumer<java.lang.String,Location> |
getWarningHandler()
Get the callback function that will be called to handle any static warnings found while
processing warnings from the XPath parser
|
int |
getXPathVersion()
Get the XPath language level supported, as an integer (being the actual version
number times ten).
|
boolean |
isInBackwardsCompatibleMode()
Determine whether Backwards Compatible Mode is used
|
void |
issueWarning(java.lang.String s,
Location locator)
Issue a compile-time warning.
|
XPathContext |
makeEarlyEvaluationContext()
Construct a dynamic context for early evaluation of constant subexpressions
|
RetainedStaticContext |
makeRetainedStaticContext()
Construct a RetainedStaticContext, which extracts information from this StaticContext
to provide the subset of static context information that is potentially needed
during expression evaluation
|
ItemType |
resolveTypeAlias(StructuredQName typeName)
Get type alias.
|
void |
setBackwardsCompatibilityMode(boolean option)
Set XPath 1.0 backwards compatibility mode on or off
|
void |
setBaseURI(java.lang.String baseURI)
Set the base URI in the static context
|
protected void |
setConfiguration(Configuration config)
Set the Configuration.
|
void |
setContainingLocation(Location location)
Set the containing location, which represents the location of the outermost expression using this
static context (typically, subexpressions will have a nested location that refers to this outer
containing location)
|
void |
setDecimalFormatManager(DecimalFormatManager manager)
Set the DecimalFormatManager used to resolve the names of decimal formats used in calls
to the format-number() function.
|
void |
setDefaultCollationName(java.lang.String collationName)
Set the name of the default collation for this static context.
|
void |
setDefaultElementNamespace(java.lang.String uri)
Set the default namespace for elements and types
|
protected void |
setDefaultFunctionLibrary()
Initialize the default function library for XPath.
|
void |
setDefaultFunctionLibrary(int version) |
void |
setDefaultFunctionNamespace(java.lang.String uri)
Set the default function namespace
|
void |
setFunctionLibrary(FunctionLibraryList lib)
Set the function library to be used
|
void |
setPackageData(PackageData packageData)
Set data about the unit of compilation (XQuery module, XSLT package)
|
void |
setSchemaAware(boolean aware)
Say whether this static context is schema-aware
|
void |
setTypeAlias(StructuredQName name,
ItemType type)
Register an alias for an ItemType.
|
void |
setUnprefixedElementMatchingPolicy(UnprefixedElementMatchingPolicy policy)
Set the policy for matching unprefixed element names.
|
void |
setWarningHandler(java.util.function.BiConsumer<java.lang.String,Location> handler)
Set a callback function that will be called to handle any static warnings found while
processing warnings from the XPath parser
|
void |
setXPathLanguageLevel(int level)
Set the XPath language level supported.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
bindVariable, getImportedSchemaNamespaces, getNamespaceResolver, getOptimizerOptions, isImportedSchema
protected void setConfiguration(Configuration config)
config
- the configurationpublic Configuration getConfiguration()
getConfiguration
in interface StaticContext
public void setPackageData(PackageData packageData)
packageData
- the package datapublic PackageData getPackageData()
getPackageData
in interface StaticContext
public void setSchemaAware(boolean aware)
aware
- true if this static context is schema-awarepublic RetainedStaticContext makeRetainedStaticContext()
makeRetainedStaticContext
in interface StaticContext
protected final void setDefaultFunctionLibrary()
public final void setDefaultFunctionLibrary(int version)
protected final void addFunctionLibrary(FunctionLibrary library)
library
- the function library to be addedpublic XPathContext makeEarlyEvaluationContext()
makeEarlyEvaluationContext
in interface StaticContext
public Location getContainingLocation()
StaticContext
getContainingLocation
in interface StaticContext
public void setContainingLocation(Location location)
location
- the location map to be usedpublic void setBaseURI(java.lang.String baseURI)
baseURI
- the base URI of the expression; the value null is allowed to indicate that the base URI is not available.public java.lang.String getStaticBaseURI()
getStaticBaseURI
in interface StaticContext
public FunctionLibrary getFunctionLibrary()
getFunctionLibrary
in interface StaticContext
public void setFunctionLibrary(FunctionLibraryList lib)
lib
- the function librarypublic void setDefaultCollationName(java.lang.String collationName)
collationName
- the name of the default collationpublic java.lang.String getDefaultCollationName()
getDefaultCollationName
in interface StaticContext
public void setWarningHandler(java.util.function.BiConsumer<java.lang.String,Location> handler)
handler
- the function to be called to handle static warnings. When a warning is
issued, the handler's accept
method is called, supplying the string
of the warning message as the argument. The default warning handler sends
the information to the default ErrorReporter
associated with the
Saxon Configuration
.public java.util.function.BiConsumer<java.lang.String,Location> getWarningHandler()
accept
method is called, supplying the string
of the warning message and the location information as the two arguments.public void issueWarning(java.lang.String s, Location locator)
issueWarning
in interface StaticContext
s
- The warning message. This should not contain any prefix such as "Warning".locator
- the location of the construct in question. May be null.public java.lang.String getSystemId()
getSystemId
in interface StaticContext
public java.lang.String getDefaultElementNamespace()
getDefaultElementNamespace
in interface StaticContext
public void setDefaultElementNamespace(java.lang.String uri)
uri
- the namespace to be used for unprefixed element and type names.
The value "" (or NamespaceConstant.NULL) represents the non-namespacepublic void setDefaultFunctionNamespace(java.lang.String uri)
uri
- the namespace to be used for unprefixed function names.
The value "" (or NamespaceConstant.NULL) represents the non-namespacepublic java.lang.String getDefaultFunctionNamespace()
getDefaultFunctionNamespace
in interface StaticContext
public void setXPathLanguageLevel(int level)
level
- the XPath language levelsetFunctionLibrary(FunctionLibraryList)
public int getXPathVersion()
getXPathVersion
in interface StaticContext
public void setBackwardsCompatibilityMode(boolean option)
option
- true if XPath 1.0 compatibility mode is to be set to true;
otherwise falsepublic boolean isInBackwardsCompatibleMode()
isInBackwardsCompatibleMode
in interface StaticContext
public void setDecimalFormatManager(DecimalFormatManager manager)
manager
- the decimal format manager for this static context, or null if no named decimal
formats are available in this environment.public ItemType getRequiredContextItemType()
getRequiredContextItemType
in interface StaticContext
public DecimalFormatManager getDecimalFormatManager()
getDecimalFormatManager
in interface StaticContext
public KeyManager getKeyManager()
getKeyManager
in interface StaticContext
public void setTypeAlias(StructuredQName name, ItemType type)
typename
has been registered as an alias for, say, map{xs:string, xs:integer*}, then
the syntax type(typename)
is accepted anywhere this ItemType would
be accepted.name
- the alias name of the typetype
- the type to which this alias referspublic ItemType resolveTypeAlias(StructuredQName typeName)
resolveTypeAlias
in interface StaticContext
typeName
- the name of the type aliaspublic void setUnprefixedElementMatchingPolicy(UnprefixedElementMatchingPolicy policy)
policy
- the policy to be usedpublic UnprefixedElementMatchingPolicy getUnprefixedElementMatchingPolicy()
getUnprefixedElementMatchingPolicy
in interface StaticContext
Copyright (c) 2004-2022 Saxonica Limited. All rights reserved.