public abstract class AbstractStaticContext extends 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
|
void |
declareCollation(String name,
StringCollator comparator,
boolean isDefault)
Declare a named collation
|
String |
getBaseURI()
Get the Base URI, for resolving any relative URI's used
in the expression.
|
StringCollator |
getCollation(String name)
Get a named collation.
|
CollationMap |
getCollationMap()
Get the collation map in use
|
int |
getColumnNumber()
Return the character position where the current document event ends.
|
Configuration |
getConfiguration()
Get the system configuration
|
DecimalFormatManager |
getDecimalFormatManager()
Get a DecimalFormatManager to resolve the names of decimal formats used in calls
to the format-number() function.
|
String |
getDefaultCollationName()
Get the name of the default collation.
|
String |
getDefaultElementNamespace()
Get the default namespace URI for elements and types
Return NamespaceConstant.NULL (that is, the zero-length string) for the non-namespace
|
String |
getDefaultFunctionNamespace()
Get the default function namespace.
|
FunctionLibrary |
getFunctionLibrary()
Get the function library containing all the in-scope functions available in this static
context.
|
int |
getHostLanguage()
Get the host language (XSLT, XQuery, XPath) used to implement the code in this container
|
int |
getLineNumber()
Get the line number of the expression within that container.
|
LocationMap |
getLocationMap()
Get the location map.
|
LocationProvider |
getLocationProvider()
Get the LocationProvider allowing location identifiers to be resolved.
|
NamePool |
getNamePool()
Get the NamePool used for compiling expressions
|
String |
getPublicId()
Return the public identifier.
|
ItemType |
getRequiredContextItemType()
Get the required type of the context item.
|
String |
getSystemId()
Get the system ID of the container of the expression.
|
DecimalValue |
getXPathLanguageLevel()
Get the XPath language level supported, as a string.
|
boolean |
isAllowedBuiltInType(BuiltInAtomicType type)
Determine whether a built-in type is available in this context.
|
boolean |
isInBackwardsCompatibleMode()
Determine whether Backwards Compatible Mode is used
|
boolean |
isSchemaAware()
Ask whether this static context is schema-aware
|
void |
issueWarning(String s,
SourceLocator locator)
Issue a compile-time warning.
|
XPathContext |
makeEarlyEvaluationContext()
Construct a dynamic context for early evaluation of constant subexpressions
|
void |
setBackwardsCompatibilityMode(boolean option)
Set XPath 1.0 backwards compatibility mode on or off
|
void |
setBaseURI(String baseURI)
Set the base URI in the static context
|
void |
setCollationMap(CollationMap collationMap)
Set a collation map to override use of the default collation map from the configuration
|
protected void |
setConfiguration(Configuration config)
Set the Configuration.
|
void |
setDecimalFormatManager(DecimalFormatManager manager)
Set the DecimalFormatManager used to resolve the names of decimal formats used in calls
to the format-number() function.
|
void |
setDefaultElementNamespace(String uri)
Set the default namespace for elements and types
|
protected void |
setDefaultFunctionLibrary()
Initialize the default function library for XPath.
|
void |
setDefaultFunctionNamespace(String uri)
Set the default function namespace
|
void |
setFunctionLibrary(FunctionLibraryList lib)
Set the function library to be used
|
void |
setLocationMap(LocationMap locationMap)
Set the location map, which is used for translating location identifiers into URIs and line
numbers
|
void |
setSchemaAware(boolean aware)
Say whether this static context is schema-aware
|
void |
setXPathLanguageLevel(DecimalValue level)
Set the XPath language level supported, as a string.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
bindVariable, getImportedSchemaNamespaces, getNamespaceResolver, getURIForPrefix, isImportedSchema
protected void setConfiguration(Configuration config)
config
- the configurationpublic Configuration getConfiguration()
getConfiguration
in interface StaticContext
public void setCollationMap(CollationMap collationMap)
collationMap
- the collation map to be usedpublic CollationMap getCollationMap()
public void setSchemaAware(boolean aware)
aware
- true if this static context is schema-awarepublic boolean isSchemaAware()
isSchemaAware
in interface StaticContext
protected final void setDefaultFunctionLibrary()
protected final void addFunctionLibrary(FunctionLibrary library)
library
- the function library to be addedpublic int getHostLanguage()
Configuration.XPATH
public XPathContext makeEarlyEvaluationContext()
makeEarlyEvaluationContext
in interface StaticContext
public LocationMap getLocationMap()
StaticContext
getLocationMap
in interface StaticContext
public void setLocationMap(LocationMap locationMap)
locationMap
- the location map to be usedpublic void setBaseURI(String baseURI)
baseURI
- the base URI of the expression; the value null is allowed to indicate that the base URI is not available.public String getBaseURI()
getBaseURI
in interface StaticContext
public FunctionLibrary getFunctionLibrary()
getFunctionLibrary
in interface StaticContext
public void setFunctionLibrary(FunctionLibraryList lib)
lib
- the function librarypublic void declareCollation(String name, StringCollator comparator, boolean isDefault)
name
- The name of the collation (technically, a URI)comparator
- The StringCollator used to implement the collating sequenceisDefault
- True if this is to be used as the default collationpublic StringCollator getCollation(String name)
getCollation
in interface StaticContext
name
- The name of the required collation. Supply null to get the default collation.public String getDefaultCollationName()
getDefaultCollationName
in interface StaticContext
public NamePool getNamePool()
getNamePool
in interface StaticContext
public void issueWarning(String s, SourceLocator 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 String getSystemId()
getSystemId
in interface StaticContext
public int getLineNumber()
getLineNumber
in interface StaticContext
public String getDefaultElementNamespace()
getDefaultElementNamespace
in interface StaticContext
public void setDefaultElementNamespace(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(String uri)
uri
- the namespace to be used for unprefixed function names.
The value "" (or NamespaceConstant.NULL) represents the non-namespacepublic String getDefaultFunctionNamespace()
getDefaultFunctionNamespace
in interface StaticContext
public void setXPathLanguageLevel(DecimalValue level)
level
- the XPath language levelpublic DecimalValue getXPathLanguageLevel()
getXPathLanguageLevel
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 boolean isAllowedBuiltInType(BuiltInAtomicType type)
isAllowedBuiltInType
in interface StaticContext
type
- the supposedly built-in type. This will always be a type in the XS namespace.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 LocationProvider getLocationProvider()
public String getPublicId()
The return value is the public identifier of the document entity or of the external parsed entity in which the markup that triggered the event appears.
getSystemId()
public int getColumnNumber()
getLineNumber()
Copyright (c) 2004-2013 Saxonica Limited. All rights reserved.