Class RetainedStaticContext

  • All Implemented Interfaces:

    public class RetainedStaticContext
    extends java.lang.Object
    implements 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 Detail

      • RetainedStaticContext

        public RetainedStaticContext​(Configuration config)
      • RetainedStaticContext

        public RetainedStaticContext​(StaticContext sc)
    • Method Detail

      • getConfiguration

        public Configuration getConfiguration()
        Get the Configuration
        the Saxon Configuration object
      • setPackageData

        public void setPackageData​(PackageData packageData)
        Set information about the package (unit of compilation
        packageData - the package data
      • getPackageData

        public PackageData getPackageData()
        Get information about the package (unit of compilation)
        the package data
      • setStaticBaseUriString

        public void setStaticBaseUriString​(java.lang.String baseUri)
        Set the static base URI as a string
        baseUri - the base URI as a string
      • getStaticBaseUri

        public getStaticBaseUri()
                                      throws XPathException
        Get the static base URI as a URI.
        the static base URI as a URI if it is known and valid. Return null if the base URI is unknown.
        XPathException - if the static base URI is not a valid URI.
      • getStaticBaseUriString

        public java.lang.String getStaticBaseUriString()
        Get the static base URI as a string.
        the static base URI as a string, or null if unknown
      • getDefaultCollationName

        public java.lang.String getDefaultCollationName()
        Get the name of the default collation for this static context
        the default collation URI
      • setDefaultCollationName

        public void setDefaultCollationName​(java.lang.String defaultCollationName)
        Set the name of the default collation for this static context
        defaultCollationName - the default collation URI
      • getDefaultFunctionNamespace

        public java.lang.String getDefaultFunctionNamespace()
        Get the default namespace for functions
        the default namespace for functions
      • setDefaultFunctionNamespace

        public void setDefaultFunctionNamespace​(java.lang.String defaultFunctionNamespace)
        Set the default namespace for functions
        defaultFunctionNamespace - the default namespace for functions
      • getDefaultElementNamespace

        public java.lang.String getDefaultElementNamespace()
        Get the default namespace for elements and types
        the default namespace for elements and types. Return "" if the default is "no namespace"
      • setDefaultElementNamespace

        public void setDefaultElementNamespace​(java.lang.String ns)
        Set the default namespace for elements and type
        ns - the default namespace for elements and types.
      • getDecimalFormatManager

        public DecimalFormatManager getDecimalFormatManager()
        Get the decimal format manager
        the decimal format manager
      • setDecimalFormatManager

        public void setDecimalFormatManager​(DecimalFormatManager decimalFormatManager)
        Set the decimal format manager
        decimalFormatManager - the decimal format manager
      • isBackwardsCompatibility

        public boolean isBackwardsCompatibility()
      • setBackwardsCompatibility

        public void setBackwardsCompatibility​(boolean backwardsCompatibility)
      • declareNamespace

        public void declareNamespace​(java.lang.String prefix,
                                     java.lang.String uri)
        Add a namespace binding to the static namespace context ("in-scope namespaces") Not supported when the static context is a JAXP XPath.
        prefix - the namespace prefix
        uri - the namespace URI
      • getURIForPrefix

        public java.lang.String getURIForPrefix​(java.lang.String prefix,
                                                boolean useDefault)
        Get the namespace URI corresponding to a given prefix. Return null if the prefix is not in scope.
        Specified by:
        getURIForPrefix in interface NamespaceResolver
        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 "".
        the uri for the namespace, or null if the prefix is not in scope. The "null namespace" is represented by the pseudo-URI "".
      • iteratePrefixes

        public java.util.Iterator<java.lang.String> 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 interface NamespaceResolver
        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

        public boolean declaresSameNamespaces​(RetainedStaticContext other)
        Test whether this static context declares the same namespaces as another static context
        other - the other static context
        true if the namespace bindings (prefix:uri pairs) are the same
      • hashCode

        public int hashCode()
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object other)
        equals in class java.lang.Object