Interface StaticContext

    • Method Detail

      • getConfiguration

        Configuration getConfiguration()
        Get the system configuration
        Returns:
        the Saxon configuration
      • getPackageData

        PackageData getPackageData()
        Get information about the containing package (unit of compilation)
        Returns:
        the package data
      • makeEarlyEvaluationContext

        XPathContext makeEarlyEvaluationContext()
        Construct a dynamic context for early evaluation of constant subexpressions.
        Returns:
        a newly constructed dynamic context
      • makeRetainedStaticContext

        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
        Returns:
        a RetainedStaticContext object: either a newly created one, or one that is reused from a previous invocation.
      • getContainingLocation

        Location getContainingLocation()
        Get the containing location. This is location information relevant to an expression or query as a whole. In the case of an XPath expression held in a node of an XML document, it will provide the location of that node. In the case of a query held in a file, it contains the location of the file (in its systemId property). The method does NOT provide fine-grained location information for each contained subexpression. The location that is returned should be immutable for the duration of parsing of an XPath expression or query.
        Returns:
        the containing location
      • issueWarning

        void issueWarning​(java.lang.String message,
                          Location locator)
        Issue a compile-time warning.
        Parameters:
        message - The warning message. This should not contain any prefix such as "Warning".
        locator - the location of the construct in question. May be null.
      • getSystemId

        java.lang.String getSystemId()
        Get the System ID of the container of the expression. This is the containing entity (file) and is therefore useful for diagnostics. Use getBaseURI() to get the base URI, which may be different.
        Returns:
        the system ID
      • getStaticBaseURI

        java.lang.String getStaticBaseURI()
        Get the static base URI, for resolving any relative URI's used in the expression. Used by the document(), doc(), resolve-uri(), and base-uri() functions. May return null if the base URI is not known.
        Returns:
        the static base URI, or null if not known
      • bindVariable

        Expression bindVariable​(StructuredQName qName)
                         throws XPathException
        Bind a variable used in this expression to the Binding object in which it is declared
        Parameters:
        qName - The name of the variable
        Returns:
        an expression representing the variable reference, This will often be a VariableReference, suitably initialized to refer to the corresponding variable declaration, but in general it can be any expression which returns the variable's value when evaluated.
        Throws:
        XPathException - if the variable cannot be bound (has not been declared)
      • getFunctionLibrary

        FunctionLibrary getFunctionLibrary()
        Get the function library containing all the in-scope functions available in this static context
        Returns:
        the function library
      • getDefaultCollationName

        java.lang.String getDefaultCollationName()
        Get the name of the default collation.
        Returns:
        the name of the default collation; or the name of the codepoint collation if no default collation has been defined
      • getDefaultElementNamespace

        java.lang.String getDefaultElementNamespace()
        Get the default XPath namespace for elements and types
        Returns:
        the default namespace, or NamespaceConstant.NULL for the non-namespace
      • getDefaultFunctionNamespace

        java.lang.String getDefaultFunctionNamespace()
        Get the default function namespace
        Returns:
        the default namespace for function names
      • isInBackwardsCompatibleMode

        boolean isInBackwardsCompatibleMode()
        Determine whether backwards compatibility mode is used
        Returns:
        true if 1.0 compaibility mode is in force.
      • isImportedSchema

        boolean isImportedSchema​(java.lang.String namespace)
        Ask whether a Schema for a given target namespace has been imported. Note that the in-scope element declarations, attribute declarations and schema types are the types registered with the (schema-aware) configuration, provided that their namespace URI is registered in the static context as being an imported schema namespace. (A consequence of this is that within a Configuration, there can only be one schema for any given namespace, including the null namespace).
        Parameters:
        namespace - the target namespace in question
        Returns:
        true if the given namespace has been imported
      • getImportedSchemaNamespaces

        java.util.Set<java.lang.String> getImportedSchemaNamespaces()
        Get the set of imported schemas
        Returns:
        a Set, the set of URIs representing the target namespaces of imported schemas, using the zero-length string to denote the "null" namespace.
      • getNamespaceResolver

        NamespaceResolver getNamespaceResolver()
        Get a namespace resolver to resolve the namespaces declared in this static context.
        Returns:
        a namespace resolver.
      • getRequiredContextItemType

        ItemType getRequiredContextItemType()
        Get the required type of the context item. If no type has been explicitly declared for the context item, an instance of AnyItemType (representing the type item()) is returned.
        Returns:
        the required type of the context item
        Since:
        9.3
      • getDecimalFormatManager

        DecimalFormatManager getDecimalFormatManager()
        Get a DecimalFormatManager to resolve the names of decimal formats used in calls to the format-number() function.
        Returns:
        the decimal format manager for this static context, or null if no named decimal formats are available in this environment.
        Since:
        9.2
      • getXPathVersion

        int getXPathVersion()
        Get the XPath language level supported, as an integer (being the actual version number times ten). In Saxon 9.9 the possible values are 20 (XPath 2.0), 30 (XPath 3.0), 31 (XPath 3.1), and 305 (XPath 3.0 plus the extensions defined in XSLT 3.0). Saxon 11 adds support for 40 (XPath 4.0).
        Returns:
        the XPath language level; the return value will be either 20, 30, 305, 31 or 40
        Since:
        9.7
      • getKeyManager

        KeyManager getKeyManager()
        Get the KeyManager, containing definitions of keys available for use.
        Returns:
        the KeyManager. This is used to resolve key names, both explicit calls on key() used in XSLT, and system-generated calls on key() which may also appear in XQuery and XPath
      • resolveTypeAlias

        ItemType resolveTypeAlias​(StructuredQName typeName)
        Get type alias. This is a Saxon extension. A type alias is a QName which can be used as a shorthand for an itemtype, using the syntax ~typename anywhere that an item type is permitted.
        Parameters:
        typeName - the name of the type alias
        Returns:
        the corresponding item type, if the name is recognised; otherwise null.
      • getOptimizerOptions

        default OptimizerOptions getOptimizerOptions()
        Get the optimization options in use. By default these are taken from the Configuration
        Returns:
        the optimization options in use