Package net.sf.saxon.expr.parser
Class RetainedStaticContext
java.lang.Object
net.sf.saxon.expr.parser.RetainedStaticContext
- All Implemented Interfaces:
NamespaceResolver
This class contains the part of the static context of expressions that (a) can change from one expression
to another within a query or stylesheet, and (b) are potentially needed at run-time.
From 9.6, the retained static context is available to every expression in the expression tree (previously, expressions only retained that part of the static context needed by the particular expression). For economy, a new RetainedStaticContext object is only created when the context changes: which is fairly rare (for example, it never happens within an XPath expression).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
declareNamespace
(String prefix, NamespaceUri uri) Add a namespace binding to the static namespace context ("in-scope namespaces") Not supported when the static context is a JAXP XPath.boolean
Test whether this static context declares the same namespaces as another static contextboolean
Get the ConfigurationGet the decimal format managerGet the name of the default collation for this static contextGet the default namespace for elements and typesGet the default namespace for functionsGet information about the package (unit of compilation)Get the static base URI as a URI.Get the static base URI as a string.getURIForPrefix
(String prefix, boolean useDefault) Get the namespace URI corresponding to a given prefix.int
hashCode()
boolean
Get an iterator over all the prefixes declared in this namespace context.void
setBackwardsCompatibility
(boolean backwardsCompatibility) void
setDecimalFormatManager
(DecimalFormatManager decimalFormatManager) Set the decimal format managervoid
setDefaultCollationName
(String defaultCollationName) Set the name of the default collation for this static contextvoid
Set the default namespace for elements and typevoid
setDefaultFunctionNamespace
(NamespaceUri defaultFunctionNamespace) Set the default namespace for functionsvoid
setNamespaces
(NamespaceResolver namespaces) Set the in-scope namespaces.void
setPackageData
(PackageData packageData) Set information about the package (unit of compilationvoid
setStaticBaseUriString
(String baseUri) Set the static base URI as a string
-
Constructor Details
-
RetainedStaticContext
-
RetainedStaticContext
-
-
Method Details
-
getConfiguration
Get the Configuration- Returns:
- the Saxon Configuration object
-
setPackageData
Set information about the package (unit of compilation- Parameters:
packageData
- the package data
-
getPackageData
Get information about the package (unit of compilation)- Returns:
- the package data
-
setStaticBaseUriString
Set the static base URI as a string- Parameters:
baseUri
- the base URI as a string
-
getStaticBaseUri
Get the static base URI as a URI.- Returns:
- the static base URI as a URI if it is known and valid. Return null if the base URI is unknown.
- Throws:
XPathException
- if the static base URI is not a valid URI.
-
getStaticBaseUriString
Get the static base URI as a string.- Returns:
- the static base URI as a string, or null if unknown
-
getDefaultCollationName
Get the name of the default collation for this static context- Returns:
- the default collation URI
-
setDefaultCollationName
Set the name of the default collation for this static context- Parameters:
defaultCollationName
- the default collation URI
-
getDefaultFunctionNamespace
Get the default namespace for functions- Returns:
- the default namespace for functions
-
setDefaultFunctionNamespace
Set the default namespace for functions- Parameters:
defaultFunctionNamespace
- the default namespace for functions
-
getDefaultElementNamespace
Get the default namespace for elements and types- Returns:
- the default namespace for elements and types. Return "" if the default is "no namespace"
-
setDefaultElementNamespace
Set the default namespace for elements and type- Parameters:
ns
- the default namespace for elements and types.
-
getDecimalFormatManager
Get the decimal format manager- Returns:
- the decimal format manager
-
setDecimalFormatManager
Set the decimal format manager- Parameters:
decimalFormatManager
- the decimal format manager
-
isBackwardsCompatibility
public boolean isBackwardsCompatibility() -
setBackwardsCompatibility
public void setBackwardsCompatibility(boolean backwardsCompatibility) -
declareNamespace
Add a namespace binding to the static namespace context ("in-scope namespaces") Not supported when the static context is a JAXP XPath.- Parameters:
prefix
- the namespace prefixuri
- the namespace URI
-
getURIForPrefix
Get the namespace URI corresponding to a given prefix. Return null if the prefix is not in scope.- Specified by:
getURIForPrefix
in interfaceNamespaceResolver
- Parameters:
prefix
- the namespace prefix. May be the zero-length string, indicating that there is no prefix. This indicates either the default namespace or the null namespace, depending on the value of useDefault.useDefault
- true if the default namespace is to be used when the prefix is "". If set to false, and the prefix is "", then the value "" is returned regardless of the default namespace in force. The "default namespace" here means the one bound to the prefix "".- Returns:
- the uri for the namespace, or null if the prefix is not in scope. The "null namespace" is represented by the pseudo-URI "".
-
iteratePrefixes
Get an iterator over all the prefixes declared in this namespace context. This will include the default namespace (prefix="") and the XML namespace where appropriate- Specified by:
iteratePrefixes
in interfaceNamespaceResolver
- Returns:
- an iterator over all the prefixes for which a namespace binding exists, including the zero-length string to represent the null/absent prefix if it is bound
-
declaresSameNamespaces
Test whether this static context declares the same namespaces as another static context- Parameters:
other
- the other static context- Returns:
- true if the namespace bindings (prefix:uri pairs) are the same
-
hashCode
public int hashCode() -
equals
-
setNamespaces
Set the in-scope namespaces.- Parameters:
namespaces
- the in-scope namespaces. The preferred representation is as a NamespaceMap; however this is not possible in the case of the JAXP XPath API, which does not allow the in-scope namespaces to be enumerated.
-
getNamespaceMap
-