Package net.sf.saxon

Class Configuration

  • All Implemented Interfaces:
    SourceResolver, NotationSet
    Direct Known Subclasses:
    ProfessionalConfiguration

    public class Configuration
    extends java.lang.Object
    implements SourceResolver, NotationSet
    This class holds details of user-selected configuration options for a set of transformations and/or queries. When running XSLT, the preferred way of setting configuration options is via the JAXP TransformerFactory interface, but the Configuration object provides a finer level of control. As yet there is no standard API for XQuery, so the only way of setting Configuration information is to use the methods on this class directly.

    As well as holding configuration settings, this class acts as a factory for classes providing service in particular areas: error handling, URI resolution, and the like. Some of these services are chosen on the basis of the current platform (Java or .NET), some vary depending whether the environment is schema-aware or not.

    The Configuration provides access to a NamePool which is used to manage all the names used in stylesheets, queries, schemas, and source and documents: the NamePool allocates integer codes to these names allowing efficient storage and comparison. Normally there will be a one-to-one relationship between a NamePool and a Configuration. It is possible, however, for several Configuration objects to share the same NamePool. Until Saxon 8.9, by default all Configuration objects shared a single NamePool unless configured otherwise; this changed in 8.9 so that the default is to allocate a new NamePool for each Configuration.

    The Configuration establishes the scope within which node identity is managed. Every document belongs to a Configuration, and every node has a distinct identity within that Configuration. In consequence, it is not possible for any query or transformation to manipulate multiple documents unless they all belong to the same Configuration.

    Saxon-EE has a subclass of the Configuration class which provides the additional services needed for schema-aware processing. The EnterpriseConfiguration also holds a cache of loaded schema components used for compiling schema-aware transformations and queries, and for validating instance documents.

    Since Saxon 8.4, the JavaDoc documentation for Saxon attempts to identify interfaces that are considered stable, and will only be changed in a backwards-incompatible way if there is an overriding reason to do so. These interfaces and methods are labelled with the JavaDoc "since" tag. The value 8.n indicates a method in this category that was introduced in Saxon version 8.n: or in the case of 8.4, that was present in Saxon 8.4 and possibly in earlier releases. (In some cases, these methods have been unchanged for a long time.) Methods without a "since" tag, although public, are provided for internal use or for use by advanced users, and are subject to change from one release to the next. The presence of a "since" tag on a class or interface indicates that there are one or more methods in the class that are considered stable; it does not mean that all methods are stable.

    Since:
    8.4
    • Field Detail

      • booleanFeatures

        protected static java.util.Set<Feature> booleanFeatures
      • defaultStaticQueryContext

        protected transient StaticQueryContext defaultStaticQueryContext
      • defaultXsltCompilerInfo

        protected CompilerInfo defaultXsltCompilerInfo
      • staticContextForSystemFunctions

        protected IndependentContext staticContextForSystemFunctions
      • xsdVersion

        protected int xsdVersion
      • byteCodeThreshold

        protected int byteCodeThreshold
      • XML10

        public static final int XML10
        Constant indicating the XML Version 1.0
        See Also:
        Constant Field Values
      • XML11

        public static final int XML11
        Constant indicating the XML Version 1.1
        See Also:
        Constant Field Values
    • Constructor Detail

      • Configuration

        public Configuration()
        Create a non-schema-aware configuration object with default settings for all options.
        Since:
        8.4
    • Method Detail

      • newConfiguration

        public static Configuration newConfiguration()
        Factory method to create a Configuration, of the class defined using conditional compilation tags when compiling this version of Saxon: that is, the type of Configuration appropriate to the edition of the software being used. This method does not check that the Configuration is licensed.
        Returns:
        a Configuration object of the class appropriate to the Saxon edition in use.
        Since:
        9.2
      • bindExtensions

        public void bindExtensions​(java.lang.String uri,
                                   cli.System.Type type)
        Declare a mapping from a specific namespace URI to a .NET class
        Parameters:
        uri - - the namespace URI of the function name
        type - - the .NET class that implements the functions in this namespace
      • locateResource

        public static java.io.InputStream locateResource​(java.lang.String filename,
                                                         java.util.List<java.lang.String> messages,
                                                         java.util.List<java.lang.ClassLoader> loaders)
        Read a resource file issued with the Saxon product
        Parameters:
        filename - the filename of the file to be read
        messages - List to be populated with messages in the event of failure
        loaders - List to be populated with the ClassLoader that succeeded in loading the resource
        Returns:
        an InputStream for reading the file/resource
      • locateResourceSource

        public static javax.xml.transform.stream.StreamSource locateResourceSource​(java.lang.String filename,
                                                                                   java.util.List<java.lang.String> messages,
                                                                                   java.util.List<java.lang.ClassLoader> loaders)
        Read a resource file issued with the Saxon product, returning a StreamSource with bound systemId This means it can be an XSLT stylesheet which uses inclusions etc.
        Parameters:
        filename - the filename of the file to be read
        messages - List to be populated with messages in the event of failure
        loaders - List to be populated with the ClassLoader that succeeded in loading the resource
        Returns:
        a StreamSource for reading the file/resource, with URL set appropriately
      • readConfiguration

        public static Configuration readConfiguration​(javax.xml.transform.Source source)
                                               throws XPathException
        Factory method to construct a Configuration object by reading a configuration file.
        Parameters:
        source - Source object containing the configuration file
        Returns:
        the resulting Configuration
        Throws:
        XPathException - if the configuration file cannot be read or is invalid
      • readConfiguration

        public static Configuration readConfiguration​(javax.xml.transform.Source source,
                                                      Configuration baseConfiguration)
                                               throws XPathException
        Factory method to construct a Configuration object by reading a configuration file. This version of the method creates a configuration that is "compatible" with the supplied configuration, in that it shares the same NamePool and DocumentNumberAllocator. (This is used by fn:transform)
        Parameters:
        source - Source object containing the configuration file
        baseConfiguration - an existing configuration whose NamePool and DocumentNumberAllocator will be used in the new Configuration; the license details from the base configuration will also be shared
        Returns:
        the resulting Configuration
        Throws:
        XPathException - if the configuration file cannot be read or is invalid
      • instantiateConfiguration

        public static Configuration instantiateConfiguration​(java.lang.String className,
                                                             java.lang.ClassLoader classLoader)
                                                      throws java.lang.ClassNotFoundException,
                                                             java.lang.InstantiationException,
                                                             java.lang.IllegalAccessException
        Instantiate a Configuration object with a given class name
        Parameters:
        className - the class name
        classLoader - the class loader to be used
        Returns:
        a Configuration of the required class
        Throws:
        java.lang.ClassNotFoundException - if the class is not found
        java.lang.InstantiationException - if the class cannot be instantiated
        java.lang.IllegalAccessException - if the class is not accessible
      • isAssertionsEnabled

        public static boolean isAssertionsEnabled()
        Ask if Java is being run with assertions enabled (-ea option)
        Returns:
        true if the -ea option is set
      • readConfigurationFile

        protected Configuration readConfigurationFile​(javax.xml.transform.Source source)
                                               throws XPathException
        Read the configuration file an construct a new Configuration (the real one)
        Parameters:
        source - the source of the configuration file
        Returns:
        the Configuration that will be used for real work
        Throws:
        XPathException - if the configuration file cannot be read or is invalid
      • init

        protected void init()
      • makeLicensedConfiguration

        public static Configuration makeLicensedConfiguration​(java.lang.ClassLoader classLoader,
                                                              java.lang.String className)
                                                       throws java.lang.RuntimeException
        Static method to instantiate a professional or enterprise configuration.

        This method fails if the specified configuration class cannot be loaded, but it does not check whether there is a license available.

        Parameters:
        classLoader - - the class loader to be used. If null, the context class loader for the current thread is used.
        className - - the name of the configuration class. Defaults to "com.saxonica.config.ProfessionalConfiguration" if null is supplied. This allows an assembly qualified name to be supplied under .NET. The class, once instantiated, must be an instance of Configuration.
        Returns:
        the new ProfessionalConfiguration or EnterpriseConfiguration
        Throws:
        java.lang.RuntimeException - if the required Saxon edition cannot be loaded
        Since:
        9.2 (renamed from makeSchemaAwareConfiguration)
      • importLicenseDetails

        public void importLicenseDetails​(Configuration config)
      • getEditionCode

        public java.lang.String getEditionCode()
        Get the edition code identifying this configuration: "HE", "PE" or "EE"
        Returns:
        the code identifying the Saxon edition associated with this configuration
      • setProcessor

        public void setProcessor​(Configuration.ApiProvider processor)
        Save the ApiProvider object that owns this Configuration in the relevant API.

        Note: it is possible to use multiple APIs over the same Configuration. This mechanism is only capable of holding one of these, and is therefore only really useful in cases where the API in use is homogeneous.

        Parameters:
        processor - This can be any ApiProvider, but it is typically one of the following:
        • When using the Java s9api interface, the net.sf.saxon.s9api.Processor
        • When using the .NET interface, the Saxon.Api.Processor
        • When using the JAXP transformation interface, the JAXP TransformerFactory
        • When using the JAXP XPath interface, the JAXP XPathFactory
        • When using the JAXP Schema interface, the JAXP SchemaFactory
        • When using XQJ, the XQDataSource
        Since:
        9.2. Changed in 9.9 to require an Configuration.ApiProvider rather than any Object.
      • getProcessor

        public Configuration.ApiProvider getProcessor()
        Get the Processor object that created this Configuration in the relevant API.

        The main purpose of this interface is to allow extension functions called from a stylesheet or query to get access to the originating processor. This is particularly useful when methods are static as there is then limited scope for passing data from the calling application to the code of the extension function.

        Returns:
        the processor that was supplied to the setProcessor(ApiProvider) method, or null if this method has not been called. In practice this property is used to hold one of the following:
        • When using the Java s9api interface, the net.sf.saxon.s9api.Processor
        • When using the .NET interface, the Saxon.Api.Processor
        • When using the JAXP transformation interface, the JAXP TransformerFactory
        • When using the JAXP XPath interface, the JAXP XPathFactory
        • When using the JAXP Schema interface, the JAXP SchemaFactory
        • When using XQJ, the XQDataSource
        Since:
        9.2. Changed in 9.9 to return an Configuration.ApiProvider rather than any Object.
      • getProductTitle

        public java.lang.String getProductTitle()
        Get a message used to identify this product when a transformation is run using the -t option
        Returns:
        A string containing both the product name and the product version
        Since:
        8.4
      • checkLicensedFeature

        public void checkLicensedFeature​(int feature,
                                         java.lang.String name,
                                         int localLicenseId)
                                  throws LicenseException
        Check whether a particular feature is licensed, with a fatal error if it is not
        Parameters:
        feature - the feature in question, identified by a constant in class Configuration.LicenseFeature
        name - the name of the feature for use in diagnostics
        localLicenseId - identifies an embedded license, or -1 if not applicable
        Throws:
        LicenseException - if the feature is not licensed. This is a RunTimeException, so it will normally be fatal.
      • disableLicensing

        public void disableLicensing()
        Instruct Saxon to run as if no license is available. This method is provided for testing purposes, so that tests with and without a license can be run without making changes to the classpath.
      • isFeatureAllowedBySecondaryLicense

        public boolean isFeatureAllowedBySecondaryLicense​(int localLicenseId,
                                                          int feature)
        Ask whether a particular feature is enabled by an embedded license (embedded in a SEF file)
        Parameters:
        localLicenseId - the identifier of the embedded license
        feature - the feature in question, identified by a constant in class Configuration.LicenseFeature
        Returns:
        true if the embedded license exists and enables the requested feature
      • isLicensedFeature

        public boolean isLicensedFeature​(int feature)
        Determine if a particular feature is licensed.
        Parameters:
        feature - the feature in question, identified by a constant in class Configuration.LicenseFeature
        Returns:
        true if the feature is licensed, false if it is not.
      • requireProfessionalLicense

        public void requireProfessionalLicense​(java.lang.String featureName)
                                        throws LicenseException
        Assert that a PE license is required, and fail if none is available
        Parameters:
        featureName - name of the required feature, to include in the error message
        Throws:
        LicenseException - if no license key is available
      • getLicenseFeature

        public java.lang.String getLicenseFeature​(java.lang.String name)
        Get the value of a named license feature
        Parameters:
        name - the name of the feature
        Returns:
        the value of the feature if present, or null otherwise
      • displayLicenseMessage

        public void displayLicenseMessage()
        Display a message about the license status
      • registerLocalLicense

        public int registerLocalLicense​(java.lang.String dmk)
        Register a local license file (for use within a single transformation (etc))
        Parameters:
        dmk - the license in encoded form
        Returns:
        an integer identifying this license uniquely within the configuration, or -1 if not accepted
      • setDynamicLoader

        public void setDynamicLoader​(DynamicLoader dynamicLoader)
        Set the DynamicLoader to be used. By default an instance of DynamicLoader is used for all dynamic loading of Java classes. This method allows the actions of the standard DynamicLoader to be overridden
        Parameters:
        dynamicLoader - the DynamicLoader to be used by this Configuration
      • getDynamicLoader

        public DynamicLoader getDynamicLoader()
        Get the DynamicLoader used by this Configuration. By default the standard system-supplied dynamic loader is returned.
        Returns:
        the DynamicLoader in use - either a user-supplied DynamicLoader, or the standard one supplied by the system.
      • getClass

        public java.lang.Class getClass​(java.lang.String className,
                                        boolean tracing,
                                        java.lang.ClassLoader classLoader)
                                 throws XPathException
        Load a class using the class name provided. Note that the method does not check that the object is of the right class.

        This method is intended for internal use only. The call is delegated to the DynamicLoader, which may be overridden by a user-defined DynamicLoader.

        Parameters:
        className - A string containing the name of the class, for example "com.microstar.sax.LarkDriver"
        tracing - true if diagnostic tracing is required
        classLoader - The ClassLoader to be used to load the class, or null to use the ClassLoader selected by the DynamicLoader.
        Returns:
        an instance of the class named, or null if it is not loadable.
        Throws:
        XPathException - if the class cannot be loaded.
      • getInstance

        public java.lang.Object getInstance​(java.lang.String className,
                                            java.lang.ClassLoader classLoader)
                                     throws XPathException
        Instantiate a class using the class name provided. Note that the method does not check that the object is of the right class.

        This method is intended for internal use only. The call is delegated to the DynamicLoader, which may be overridden by a user-defined DynamicLoader.

        Diagnostic output is produced if the option "isTiming" is set (corresponding to the -t option on the command line).

        Parameters:
        className - A string containing the name of the class, for example "com.microstar.sax.LarkDriver"
        classLoader - The ClassLoader to be used to load the class, or null to use the ClassLoader selected by the DynamicLoader.
        Returns:
        an instance of the class named, or null if it is not loadable.
        Throws:
        XPathException - if the class cannot be loaded.
      • setAllowedUriTest

        public void setAllowedUriTest​(java.util.function.Predicate<java.net.URI> test)
        Set a Predicate that is applied to a URI to determine whether the standard resource resolvers (URIResolver, UnparsedTextURIResolver, SchemaURIResolver, CollationURIResolver, ModuleURIResolver) should accept it.

        It is possible to set a predicate by means of the configuration property Feature.ALLOWED_PROTOCOLS. This method, however, allows an arbitrary predicate to be supplied.

        The predicate is only applicable to resolvers that choose to use it. This includes all the standard Saxon-supplied resolvers, but user-supplied resolvers can bypass this check.

        Parameters:
        test - a condition that a URI must satisfy if access to a resource with this URI is to be permitted
      • getAllowedUriTest

        public java.util.function.Predicate<java.net.URI> getAllowedUriTest()
        Get the Predicate that is applied to a URI to determine whether the standard resource resolvers (URIResolver, UnparsedTextURIResolver, SchemaURIResolver, CollationURIResolver, ModuleURIResolver) should accept it.

        It is possible to set a predicate by means of the configuration property Feature.ALLOWED_PROTOCOLS.

        The predicate is only applicable to resolvers that choose to use it. This includes all the standard Saxon-supplied resolvers, but user-supplied resolvers can bypass this check.

        Returns:
        a condition that a URI must satisfy if access to a resource with this URI is to be permitted
      • getURIResolver

        public javax.xml.transform.URIResolver getURIResolver()
        Get the URIResolver used in this configuration
        Returns:
        the URIResolver. If no URIResolver has been set explicitly, the default URIResolver is used.
        Since:
        8.4
      • setURIResolver

        public void setURIResolver​(javax.xml.transform.URIResolver resolver)
        Set the URIResolver to be used in this configuration. This will be used to resolve the URIs used statically (e.g. by xsl:include) and also the URIs used dynamically by functions such as document() and doc(). Note that the URIResolver does not resolve the URI in the sense of RFC 2396 (which is also the sense in which the resolve-uri() function uses the term): rather it dereferences an absolute URI to obtain an actual resource, which is returned as a Source object.
        Parameters:
        resolver - The URIResolver to be used.
        Since:
        8.4
      • setParameterizedURIResolver

        public void setParameterizedURIResolver()
        Set the URIResolver to a URI resolver that allows query parameters after the URI, and in the case of Saxon-EE, that inteprets the file extension .ptree
      • getSystemURIResolver

        public StandardURIResolver getSystemURIResolver()
        Get the system-defined URI Resolver. This is used when the user-defined URI resolver returns null as the result of the resolve() method
        Returns:
        the system-defined URI resolver
      • makeURIResolver

        public javax.xml.transform.URIResolver makeURIResolver​(java.lang.String className)
                                                        throws javax.xml.transform.TransformerException
        Create an instance of a URIResolver with a specified class name. Note that this method does not register the URIResolver with this Configuration.
        Parameters:
        className - The fully-qualified name of the URIResolver class
        Returns:
        The newly created URIResolver
        Throws:
        javax.xml.transform.TransformerException - if the requested class does not implement the javax.xml.transform.URIResolver interface
      • setErrorReporterFactory

        public void setErrorReporterFactory​(java.util.function.Function<Configuration,​? extends ErrorReporter> factory)
      • getLogger

        public Logger getLogger()
      • reportFatalError

        public void reportFatalError​(XPathException err)
        Report a fatal error
        Parameters:
        err - the exception to be reported
      • setLogger

        public void setLogger​(Logger logger)
        Register a new logger to be used in the Saxon event logging mechanism
        Parameters:
        logger - the Logger to be used as default. The caller is responsible for ensuring that this is closed after use (if necessary), which can be achieved by calling either Logger.close() or close();
        Since:
        9.6
      • setStandardErrorOutput

        public void setStandardErrorOutput​(java.io.PrintStream out)
        Set the standard error output to be used in all cases where no more specific destination is defined. This defaults to System.err.

        The method has no effect unless the getLogger() object is an instance of StandardLogger. In that case it calls StandardLogger.setPrintStream(PrintStream)

        Parameters:
        out - the stream to be used for error output where no more specific destination has been supplied. The caller is responsible for closing this stream after use (if necessary).
        Since:
        9.3
      • getStandardErrorOutput

        public java.io.PrintStream getStandardErrorOutput()
        Get the standard error output to be used in all cases where no more specific destination is defined. This defaults to System.err.
        Returns:
        If the getLogger() object is an instance of StandardLogger, then the value of StandardLogger.getPrintStream(); otherwise System.err.
        Since:
        9.3
      • setXMLVersion

        public void setXMLVersion​(int version)
        Set the XML version to be used by default for validating characters and names. Note that source documents specifying xml version="1.0" or "1.1" are accepted regardless of this setting. The effect of this switch is to change the validation rules for types such as Name and NCName, to change the meaning of \i and \c in regular expressions, and to determine whether the serializer allows XML 1.1 documents to be constructed.
        Parameters:
        version - one of the constants XML10 or XML11
        Since:
        8.6
      • getXMLVersion

        public int getXMLVersion()
        Get the XML version to be used by default for validating characters and names
        Returns:
        one of the constants XML10 or XML11
        Since:
        8.6
      • getParseOptions

        public ParseOptions getParseOptions()
        Get the parsing and document building options defined in this configuration
        Returns:
        the parsing and document building options. Note that any changes to this ParseOptions object will be reflected back in the Configuration; if changes are to be made locally, the caller should create a copy.
        Since:
        9.2
      • setMediaQueryEvaluator

        public void setMediaQueryEvaluator​(java.util.Comparator<java.lang.String> comparator)
        Set a comparator which can be used to assess whether the media pseudo-attribute in an xml-stylesheet processing instruction matches the media requested in the API for the transformation
        Parameters:
        comparator - a comparator which returns 0 (equals) when the first argument of the compare method is the value of the media attribute in the xml-stylesheet processing instruction, and the second argument is the value of the required media given in the calling API. The default implementation always returns 0, indicating that the media pseudo-attribute is ignored. An alternative implementation, consistent with previous Saxon releases, would be compare the strings for equality. A fully conformant implementation could implement the syntax and semantics of media queries as defined in CSS 3.
      • getMediaQueryEvaluator

        public java.util.Comparator<java.lang.String> getMediaQueryEvaluator()
        Get a comparator which can be used to assess whether the media pseudo-attribute in an xml-stylesheet processing instruction matches the media requested in the API for the transformation
        Returns:
        a comparator which returns 0 (equals) when the first argument of the compare method is the value of the media attribute in the xml-stylesheet processing instruction, and the second argument is the value of the required media given in the calling API. The default implementation always returns 0, indicating that the media pseudo-attribute is ignored. An alternative implementation, consistent with previous Saxon releases, would be compare the strings for equality. A fully conformant implementation could implement the syntax and semantics of media queries as defined in CSS 3.
      • setConversionRules

        public void setConversionRules​(ConversionRules rules)
        Set the conversion rules to be used to convert between atomic types. By default, The rules depend on the versions of XML and XSD in use by the configuration.
        Parameters:
        rules - the conversion rules to be used
        Since:
        9.3
      • getConversionRules

        public ConversionRules getConversionRules()
        Get the conversion rules used to convert between atomic types. By default, the rules depend on the versions of XML and XSD in use by the configuration
        Returns:
        the appropriate conversion rules
        Since:
        9.3
      • getXsdVersion

        public int getXsdVersion()
        Get the version of XML Schema to be used
        Returns:
        XSD10 or XSD11
        Since:
        9.2
      • getConversionContext

        public XPathContext getConversionContext()
        Get an XPathContext object with sufficient capability to perform comparisons and conversions
        Returns:
        a dynamic context for performing conversions
      • getValidCharacterChecker

        public java.util.function.IntPredicate getValidCharacterChecker()
        Get an IntPredicate that tests whether a given character is valid in the selected version of XML
        Returns:
        an IntPredicate whose matches() method tests a character for validity against the version of XML (1.0 or 1.1) selected by this configuration
      • setTreeModel

        public void setTreeModel​(int treeModel)
        Set the Tree Model used by this Configuration. This is typically Builder.LINKED_TREE or Builder.TINY_TREE, or Builder.TINY_TREE_CONDENSED. The default is Builder.TINY_TREE.
        Parameters:
        treeModel - the integer constant representing the selected Tree Model
        Since:
        8.4 (Condensed tinytree added in 9.2)
      • isLineNumbering

        public boolean isLineNumbering()
        Determine whether source documents will maintain line numbers, for the benefit of the saxon:line-number() extension function as well as run-time tracing.
        Returns:
        true if line numbers are maintained in source documents
        Since:
        8.4
      • setLineNumbering

        public void setLineNumbering​(boolean lineNumbering)
        Determine whether source documents will maintain line numbers, for the benefit of the saxon:line-number() extension function as well as run-time tracing.
        Parameters:
        lineNumbering - true if line numbers are maintained in source documents
        Since:
        8.4
      • setXIncludeAware

        public void setXIncludeAware​(boolean state)
        Set whether or not source documents (including stylesheets and schemas) are have XInclude processing applied to them, or not. Default is false.
        Parameters:
        state - true if XInclude elements are to be expanded, false if not
        Since:
        8.9
      • isXIncludeAware

        public boolean isXIncludeAware()
        Test whether or not source documents (including stylesheets and schemas) are to have XInclude processing applied to them, or not
        Returns:
        true if XInclude elements are to be expanded, false if not
        Since:
        8.9
      • setTraceListener

        public void setTraceListener​(TraceListener traceListener)
        Set the TraceListener to be used for run-time tracing of instruction execution.

        Note: this method should not be used if the Configuration is multithreading. In that situation, use setCompileWithTracing(boolean) to force stylesheets and queries to be compiled with trace code enabled, and use Controller.addTraceListener(net.sf.saxon.lib.TraceListener) to supply a TraceListener at run time.

        Parameters:
        traceListener - The TraceListener to be used. If null is supplied, any existing TraceListener is removed
        Since:
        8.4
      • setTraceListenerClass

        public void setTraceListenerClass​(java.lang.String className)
        Set the name of the trace listener class to be used for run-time tracing of instruction execution. A new instance of this class will be created for each query or transformation that requires tracing. The class must be an instance of TraceListener.
        Parameters:
        className - the name of the trace listener class. If null, any existing trace listener is removed from the configuration.
        Throws:
        java.lang.IllegalArgumentException - if the class cannot be instantiated or does not implement TraceListener
        Since:
        9.1. Changed in 9.4 to allow null to be supplied.
      • getTraceListenerClass

        public java.lang.String getTraceListenerClass()
        Get the name of the trace listener class to be used for run-time tracing of instruction execution. A new instance of this class will be created for each query or transformation that requires tracing. The class must be an instance of TraceListener.
        Returns:
        the name of the trace listener class, or null if no trace listener class has been nominated.
        Since:
        9.1
      • setTraceListenerOutputFile

        public void setTraceListenerOutputFile​(java.lang.String filename)
        Set the name of the file to be used for TraceListener output. (By default, it is sent to System.err)
        Parameters:
        filename - the filename for TraceListener output
        Since:
        9.8
      • getTraceListenerOutputFile

        public java.lang.String getTraceListenerOutputFile()
        Get the name of the file to be used for TraceListener output. Returns null if no value has been set
        Returns:
        the filename to be used for TraceListener output, or null if none has been set
        Since:
        9.8
      • isCompileWithTracing

        public boolean isCompileWithTracing()
        Determine whether compile-time generation of trace code was requested
        Returns:
        true if compile-time generation of code was requested at the Configuration level. Note that tracing can also be requested at the XQueryCompiler or XsltCompiler level.
        Since:
        8.8
      • setCompileWithTracing

        public void setCompileWithTracing​(boolean trace)
        Request compile-time generation of trace code (or not)
        Parameters:
        trace - true if compile-time generation of trace code is required
        Since:
        8.8
      • makeTraceListener

        public TraceListener makeTraceListener​(java.lang.String className)
                                        throws XPathException
        Create an instance of a TraceListener with a specified class name
        Parameters:
        className - The fully qualified class name of the TraceListener to be constructed
        Returns:
        the newly constructed TraceListener
        Throws:
        XPathException - if the requested class does not implement the net.sf.saxon.trace.TraceListener interface
      • makeSystemFunction

        public SystemFunction makeSystemFunction​(java.lang.String localName,
                                                 int arity)
        Make a function in the "fn" namespace
        Parameters:
        localName - the local name of the function
        arity - the arity of the function
        Returns:
        the function
      • registerExtensionFunction

        public void registerExtensionFunction​(ExtensionFunctionDefinition function)
        Register an extension function that is to be made available within any stylesheet, query, or XPath expression compiled under the control of this processor. This method registers an extension function implemented as an instance of ExtensionFunctionDefinition, using an arbitrary name and namespace. This supplements the ability to call arbitrary Java methods using a namespace and local name that are related to the Java class and method name.
        Parameters:
        function - the object that implements the extension function.
        Since:
        9.2
      • getIntegratedFunctionLibrary

        public IntegratedFunctionLibrary getIntegratedFunctionLibrary()
        Get the IntegratedFunction library containing integrated extension functions
        Returns:
        the IntegratedFunctionLibrary
        Since:
        9.2
      • bindSaxonExtensionFunction

        public SystemFunction bindSaxonExtensionFunction​(java.lang.String localName,
                                                         int arity)
                                                  throws XPathException
        Instantiate a Saxon extension function. This generally requires Saxon-PE or higher, so it will fail with this Configuration
        Parameters:
        localName - the local name of the function in the Saxon namespace
        arity - the function arity
        Returns:
        the system function with this name and arity
        Throws:
        XPathException
      • addExtensionBinders

        public void addExtensionBinders​(FunctionLibraryList list)
        Add the registered extension binders to a function library. This method is intended primarily for internal use
        Parameters:
        list - the function library list
      • getSystemFunction

        public Function getSystemFunction​(StructuredQName name,
                                          int arity)
        Get a system function. This can be any function defined in XPath 3.1 functions and operators, including functions in the math, map, and array namespaces. It can also be a Saxon extension function, provided a licensed Processor is used.
        Parameters:
        name - the name of the required function
        arity - the arity of the required function
        Returns:
        the requested function, or null if there is no such function. Note that some functions (those with particular context dependencies) may be unsuitable for dynamic calling.
      • newUserFunction

        public UserFunction newUserFunction​(boolean memoFunction,
                                            FunctionStreamability streamability)
        Make a UserFunction object. This method is for internal use.
        Parameters:
        memoFunction - true if the function is to be a memo function.
        streamability - the declared streamability of the function
        Returns:
        the newly created user-defined function
      • registerCollation

        public void registerCollation​(java.lang.String collationURI,
                                      StringCollator collator)
        Register a collation. Collation URIs registered using this interface will be picked up before calling the CollationURIResolver.
        Parameters:
        collationURI - the URI of the collation. This should be an absolute URI, though it is not checked
        collator - the implementation of the collation
        Since:
        9.6
      • setCollationURIResolver

        public void setCollationURIResolver​(CollationURIResolver resolver)
        Set a CollationURIResolver to be used to resolve collation URIs (that is, to take a URI identifying a collation, and return the corresponding collation). Note that Saxon attempts first to resolve a collation URI using the resolver registered with the Controller; if that returns null, it tries again using the resolver registered with the Configuration.

        Note that it is undefined whether collation URIs are resolved at compile time or at run-time. It is therefore inadvisable to change the CollationURIResolver after compiling a query or stylesheet and before running it.

        Parameters:
        resolver - the collation URI resolver to be used. This replaces any collation URI resolver previously registered.
        Since:
        8.5
      • getCollationURIResolver

        public CollationURIResolver getCollationURIResolver()
        Get the collation URI resolver associated with this configuration. This will return the CollationURIResolver previously set using the setCollationURIResolver(net.sf.saxon.lib.CollationURIResolver) method; if this has not been called, it returns the system-defined collation URI resolver
        Returns:
        the registered CollationURIResolver
        Since:
        8.5
      • getCollation

        public StringCollator getCollation​(java.lang.String collationName)
                                    throws XPathException
        Get the collation with a given collation name. If the collation name has not been registered in this CollationMap, the CollationURIResolver registered with the Configuration is called. If this cannot resolve the collation name, it should return null.
        Parameters:
        collationName - the collation name as an absolute URI
        Returns:
        the StringCollator with this name if known, or null if not known
        Throws:
        XPathException - if the collation URI is recognized but is invalid; for example, if it is a URI that takes parameters, and the parameters are invalid. If a user-supplied collation URI resolver is in use, then any exception thrown by that resolver is passed on to the caller.
      • getCollation

        public StringCollator getCollation​(java.lang.String collationURI,
                                           java.lang.String baseURI)
                                    throws XPathException
        Get the collation with a given collation name, supplying a relative URI and base URI separately. If the collation name has not been registered in this CollationMap, the CollationURIResolver registered with the Configuration is called. If this cannot resolve the collation name, it should return null.
        Parameters:
        collationURI - the collation name as a relative or absolute URI
        baseURI - the base URI to be used to resolve the collationURI if it is relative
        Returns:
        the StringCollator with this name if known, or null if not known
        Throws:
        XPathException - if a failure occurs during URI resolution
      • getCollation

        public StringCollator getCollation​(java.lang.String collationURI,
                                           java.lang.String baseURI,
                                           java.lang.String errorCode)
                                    throws XPathException
        Get the collation with a given collation name, supplying a relative URI and base URI separately, and throwing an error if it cannot be found. If the collation name has not been registered in this CollationMap, the CollationURIResolver registered with the Configuration is called. If this cannot resolve the collation name, it should return null.
        Parameters:
        collationURI - the collation name as a relative or absolute URI
        baseURI - the base URI to be used to resolve the collationURI if it is relative; may be null if the supplied collationURI is known to be absolute
        errorCode - the error to raise if the collation is not known
        Returns:
        the StringCollator with this name if known, or null if not known
        Throws:
        XPathException - if a failure occurs during URI resolution
      • getDefaultCollationName

        public java.lang.String getDefaultCollationName()
        Get the name of the global default collation
        Returns:
        the name of the default collation. If none has been set, returns the URI of the Unicode codepoint collation
      • setDefaultCollection

        public void setDefaultCollection​(java.lang.String uri)
        Set the default collection.

        If no default collection URI is specified, then a request for the default collection is handled by calling the registered collection URI resolver with an argument of null.

        Parameters:
        uri - the URI of the default collection. Calling the collection() function with no arguments is equivalent to calling collection() with this URI as an argument. The URI will be dereferenced by passing it to the registered CollectionFinder. If null is supplied, any existing default collection is removed.
        Since:
        9.2
      • getDefaultCollection

        public java.lang.String getDefaultCollection()
        Get the URI of the default collection. Returns null if no default collection URI has been registered.
        Returns:
        the default collection URI. This is dereferenced in the same way as a normal collection URI (via the CollectionFinder) to return a sequence of nodes
        Since:
        9.2
      • setCollectionFinder

        public void setCollectionFinder​(CollectionFinder cf)
        Set the collection finder associated with this configuration. This is used to dereference collection URIs used in the fn:collection and fn:uri-collection functions
        Parameters:
        cf - the CollectionFinder to be used
        Since:
        9.7
      • getCollectionFinder

        public CollectionFinder getCollectionFinder()
        Get the collection finder associated with this configuration. This is used to dereference collection URIs used in the fn:collection and fn:uri-collection functions
        Returns:
        the CollectionFinder to be used
        Since:
        9.7
      • getStandardCollectionFinder

        public StandardCollectionFinder getStandardCollectionFinder()
        Get the standard collection finder. This is always an instance of StandardCollectionFinder and there is no way of changing it. It is available for calling from a user-supplied collection finder as a way to delegate processing, in the event that the user-supplied collection finder wants to handle some collection URIs its own way, and others in the standard way
        Returns:
        the standard collection finder
      • registerCollection

        public void registerCollection​(java.lang.String collectionURI,
                                       ResourceCollection collection)
        Register a specific URI and bind it to a specific ResourceCollection. This method modifies the standard collection finder (as returned by getStandardCollectionFinder(), and it also modifies the user-supplied collection finder (as returned by getCollectionFinder() if and only if this is an instance of the class StandardCollectionFinder.
        Parameters:
        collectionURI - the collection URI to be registered. Must not be null.
        collection - the ResourceCollection to be associated with this URI. Must not be null.
        Since:
        9.7.0.2. Modified in 10.0 to work on the standard collection finder in all cases, so there is no failure if the user-supplied collection finder does not implement the StandardCollectionFinder interface.
      • registerFileExtension

        public void registerFileExtension​(java.lang.String extension,
                                          java.lang.String mediaType)
        Set the media type to be associated with a file extension by the standard collection handler
        Parameters:
        extension - the file extension, for example "xml". The value "" sets the default media type to be used for unregistered file extensions.
        mediaType - the corresponding media type, for example "application/xml". The choice of media type determines how a resource with this extension gets parsed, when the file appears as part of a collection.
        Since:
        9.7.0.1
      • registerMediaType

        public void registerMediaType​(java.lang.String contentType,
                                      ResourceFactory factory)
        Associate a media type with a resource factory. This method may be called to customize the behaviour of a collection to recognize different file extensions
        Parameters:
        contentType - a media type or MIME type, for example application/xsd+xml
        factory - a ResourceFactory used to parse (or otherwise process) resources of that type
        Since:
        9.7.0.6
      • getMediaTypeForFileExtension

        public java.lang.String getMediaTypeForFileExtension​(java.lang.String extension)
        Get the media type to be associated with a file extension by the standard collection handler
        Parameters:
        extension - the file extension, for example "xml". The value "" gets the default media type to be used for unregistered file extensions. the default media type is also returned if the supplied file extension is not registered.
        Returns:
        the corresponding media type, for example "application/xml". The choice of media type determines how a resource with this extension gets parsed, when the file appears as part of a collection.
        Since:
        9.7.0.1
      • getResourceFactoryForMediaType

        public ResourceFactory getResourceFactoryForMediaType​(java.lang.String mediaType)
        Get the resource factory associated with a media type
        Parameters:
        mediaType - the media type or MIME type, for example "application/xml"
        Returns:
        the associated resource factory if one has been registered for this media type, or null otherwise
      • setLocalizerFactory

        public void setLocalizerFactory​(LocalizerFactory factory)
        Set the localizer factory to be used
        Parameters:
        factory - the LocalizerFactory
        Since:
        9.2
      • getLocalizerFactory

        public LocalizerFactory getLocalizerFactory()
        Get the localizer factory in use
        Returns:
        the LocalizerFactory, if any. If none has been set, returns null.
        Since:
        9.2
      • setDefaultLanguage

        public void setDefaultLanguage​(java.lang.String language)
        Set the default language to be used for number and date formatting when no language is specified. If none is set explicitly, the default Locale for the Java Virtual Machine is used.
        Parameters:
        language - the default language to be used, as an ISO code for example "en" or "fr-CA"
        Throws:
        java.lang.IllegalArgumentException - if not valid as an xs:language instance.
        Since:
        9.2. Validated from 9.7 against xs:language type.
      • getDefaultLanguage

        public java.lang.String getDefaultLanguage()
        Get the default language. Unless an explicit default is set, this will be the language of the default Locale for the Java Virtual Machine
        Returns:
        the default language
        Since:
        9.2
      • setDefaultCountry

        public void setDefaultCountry​(java.lang.String country)
        Set the default country to be used for number and date formatting when no country is specified. If none is set explicitly, the default Locale for the Java Virtual Machine is used.
        Parameters:
        country - the default country to be used, as an ISO code for example "US" or "GB"
        Since:
        9.2
      • getDefaultCountry

        public java.lang.String getDefaultCountry()
        Get the default country to be used for number and date formatting when no country is specified. If none is set explicitly, the default Locale for the Java Virtual Machine is used.
        Returns:
        the default country to be used, as an ISO code for example "US" or "GB"
        Since:
        9.2
      • setDefaultRegexEngine

        public void setDefaultRegexEngine​(java.lang.String engine)
        Set the default regular expression engine to be used
        Parameters:
        engine - the default regular expression engine to be used. The value must be one of:
        • S - the Saxon regular expression engine (derived form Apache Jakarta)
        • J - the Java JDK regular expression engine
        • N - (on .NET only) - the .NET regular expression engine
      • getDefaultRegexEngine

        public java.lang.String getDefaultRegexEngine()
        Get the default regular expression to be used
        Returns:
        the default regular expression to be used. Returns "S" if no value has been explicitly set.
      • compileRegularExpression

        public RegularExpression compileRegularExpression​(java.lang.CharSequence regex,
                                                          java.lang.String flags,
                                                          java.lang.String hostLanguage,
                                                          java.util.List<java.lang.String> warnings)
                                                   throws XPathException
        Compile a regular expression (or, in some configurations, get a compiled regular expression from a cache
        Parameters:
        regex - the regular expression as a string
        flags - the value of the flags attribute
        hostLanguage - one of "XSD10", "XSD11", XP20" or "XP30". Also allow combinations, e.g. "XP20/XSD11".
        warnings - if non-null, any warnings from the regular expression compiler will be added to this list. If null, the warnings are ignored.
        Returns:
        the compiled regular expression
        Throws:
        XPathException - if the regular expression or the flags are invalid
      • makeNumberer

        public Numberer makeNumberer​(java.lang.String language,
                                     java.lang.String country)
        Load a Numberer class for a given language and check it is OK. This method is provided primarily for internal use.
        Parameters:
        language - the language for which a Numberer is required. May be null, indicating default language
        country - the country for which a Numberer is required. May be null, indicating default country
        Returns:
        a suitable numberer. If no specific numberer is available for the language, the default numberer (normally English) is used.
      • setModuleURIResolver

        public void setModuleURIResolver​(ModuleURIResolver resolver)
        Set a user-defined ModuleURIResolver for resolving URIs used in "import module" declarations in an XQuery prolog. This acts as the default value for the ModuleURIResolver in the StaticQueryContext, and may be overridden by a more specific ModuleURIResolver nominated as part of the StaticQueryContext.
        Parameters:
        resolver - the URI resolver for XQuery modules. May be null, in which case any existing Module URI Resolver is removed from the configuration
      • setModuleURIResolver

        public void setModuleURIResolver​(java.lang.String className)
                                  throws javax.xml.transform.TransformerException
        Create and register an instance of a ModuleURIResolver with a specified class name. This will be used for resolving URIs in XQuery "import module" declarations, unless a more specific ModuleURIResolver has been nominated as part of the StaticQueryContext.
        Parameters:
        className - The fully-qualified name of the LocationHintResolver class
        Throws:
        javax.xml.transform.TransformerException - if the requested class does not implement the net.sf.saxon.LocationHintResolver interface
      • getModuleURIResolver

        public ModuleURIResolver getModuleURIResolver()
        Get the user-defined ModuleURIResolver for resolving URIs used in "import module" declarations in the XQuery prolog; returns null if none has been explicitly set.
        Returns:
        the resolver for Module URIs
      • getStandardModuleURIResolver

        public ModuleURIResolver getStandardModuleURIResolver()
        Get the standard system-defined ModuleURIResolver for resolving URIs used in "import module" declarations in the XQuery prolog.
        Returns:
        the standard system-defined ModuleURIResolver for resolving URIs
      • getUnparsedTextURIResolver

        public UnparsedTextURIResolver getUnparsedTextURIResolver()
        Get the URI resolver used for resolving URIs passed to the unparsed-text(), unparsed-text-available(), and unparsed-text-lines() functions
        Returns:
        the URI resolver set for these functions, if one has been set, or the standard system-supplied resolver otherwise
      • setUnparsedTextURIResolver

        public void setUnparsedTextURIResolver​(UnparsedTextURIResolver resolver)
        Set the URI resolver to be used for resolving URIs passed to the unparsed-text(), unparsed-text-available(), and unparsed-text-lines() functions
        Parameters:
        resolver - the URI resolver to be used for these functions.
      • getDefaultXsltCompilerInfo

        public CompilerInfo getDefaultXsltCompilerInfo()
        Get the default options for XSLT compilation
        Returns:
        the default options for XSLT compilation. The CompilerInfo object will reflect any options set using other methods available for this Configuration object
      • getDefaultStaticQueryContext

        public StaticQueryContext getDefaultStaticQueryContext()
        Get the default options for XQuery compilation
        Returns:
        the default XQuery static context for this configuration
      • makeStaticQueryContext

        protected StaticQueryContext makeStaticQueryContext​(boolean copyFromDefault)
        Make a new static query context object using the factory registered with this configuration
        Parameters:
        copyFromDefault - true if the new static query context is to copy the properties of the default static query context held in the configuration
        Returns:
        the new static query context object
      • registerFunctionAnnotationHandler

        public void registerFunctionAnnotationHandler​(FunctionAnnotationHandler handler)
        Register a FunctionAnnotationHandler to handle XQuery function annotations in a particular namespace
        Parameters:
        handler - a function annotation handler to be invoked in respect of function annotations in the relevant namespace
      • getFunctionAnnotationHandler

        public FunctionAnnotationHandler getFunctionAnnotationHandler​(java.lang.String namespace)
        Get the FunctionAnnotationHandler used to handle XQuery function annotations in a particular namespace
        Parameters:
        namespace - the namespace
        Returns:
        a function annotation handler to be invoked in respect of function annotations in the relevant namespace, or null if none has been registered
      • isStreamabilityEnabled

        public boolean isStreamabilityEnabled()
        Ask whether streamability checking is enabled for this configuration
        Returns:
        always false for Saxon-HE
      • getMessageEmitterClass

        public java.lang.String getMessageEmitterClass()
        Get the name of the class that will be instantiated to create a MessageEmitter, to process the output of xsl:message instructions in XSLT.
        Returns:
        the full class name of the message emitter class.
        Since:
        8.4
      • setMessageEmitterClass

        public void setMessageEmitterClass​(java.lang.String messageReceiverClassName)
        Set the name of the class that will be instantiated to to process the output of xsl:message instructions in XSLT.
        Parameters:
        messageReceiverClassName - the full class name of the message receiver. This must implement net.sf.saxon.event.Receiver.
        Since:
        8.4
      • getSourceParserClass

        public java.lang.String getSourceParserClass()
        Get the name of the class that will be instantiated to create an XML parser for parsing source documents (for example, documents loaded using the document() or doc() functions).

        This method is retained in Saxon for backwards compatibility, but the preferred way of choosing an XML parser is to use JAXP interfaces, for example by supplying a JAXP SAXSource object initialized with an appropriate implementation of org.xml.sax.XMLReader.

        Returns:
        the fully qualified name of the XML parser class
      • setSourceParserClass

        public void setSourceParserClass​(java.lang.String sourceParserClass)
        Set the name of the class that will be instantiated to create an XML parser for parsing source documents (for example, documents loaded using the document() or doc() functions).

        This method is retained in Saxon for backwards compatibility, but the preferred way of choosing an XML parser is to use JAXP interfaces, for example by supplying a JAXP SAXSource object initialized with an appropriate implementation of org.xml.sax.XMLReader.

        Parameters:
        sourceParserClass - the fully qualified name of the XML parser class. This must implement the SAX2 XMLReader interface.
      • getStyleParserClass

        public java.lang.String getStyleParserClass()
        Get the name of the class that will be instantiated to create an XML parser for parsing stylesheet modules.

        This method is retained in Saxon for backwards compatibility, but the preferred way of choosing an XML parser is to use JAXP interfaces, for example by supplying a JAXP Source object initialized with an appropriate implementation of org.xml.sax.XMLReader.

        Returns:
        the fully qualified name of the XML parser class
      • setStyleParserClass

        public void setStyleParserClass​(java.lang.String parser)
        Set the name of the class that will be instantiated to create an XML parser for parsing stylesheet modules.

        This method is retained in Saxon for backwards compatibility, but the preferred way of choosing an XML parser is to use JAXP interfaces, for example by supplying a JAXP Source object initialized with an appropriate implementation of org.xml.sax.XMLReader.

        Parameters:
        parser - the fully qualified name of the XML parser class
      • getOutputURIResolver

        public OutputURIResolver getOutputURIResolver()
        Get the OutputURIResolver that will be used to resolve URIs used in the href attribute of the xsl:result-document instruction.
        Returns:
        the OutputURIResolver. If none has been supplied explicitly, the default OutputURIResolver is returned.
        Since:
        8.4
      • setOutputURIResolver

        public void setOutputURIResolver​(OutputURIResolver outputURIResolver)
        Deprecated.
        since 9.9. Use AbstractXsltTransformer.setResultDocumentHandler(java.util.function.Function) or XsltController.setResultDocumentResolver(ResultDocumentResolver) instead.
        Set the OutputURIResolver that will be used to resolve URIs used in the href attribute of the xsl:result-document instruction.
        Parameters:
        outputURIResolver - the OutputURIResolver to be used.
        Since:
        8.4
      • setSerializerFactory

        public void setSerializerFactory​(SerializerFactory factory)
        Set a custom SerializerFactory. This will be used to create a serializer for a given set of output properties and result destination.
        Parameters:
        factory - a custom SerializerFactory
        Since:
        8.8
      • getSerializerFactory

        public SerializerFactory getSerializerFactory()
        Get the SerializerFactory. This returns the standard built-in SerializerFactory, unless a custom SerializerFactory has been registered.
        Returns:
        the SerializerFactory in use
        Since:
        8.8
      • getCharacterSetFactory

        public CharacterSetFactory getCharacterSetFactory()
        Get the CharacterSetFactory. Note: at present this cannot be changed.
        Returns:
        the CharacterSetFactory in use.
        Since:
        9.2
      • setDefaultSerializationProperties

        public void setDefaultSerializationProperties​(java.util.Properties props)
        Set the default serialization properties.

        The method name is a misnomer, retained for backwards compatibility. A SerializationProperties object contains a set of Properties holding simple properties, together with an optional CharacterMap holding a character map. This method returns the simple properties only. In fact the default properties held in the Configuration only contain simple properties, and never a character map.

        Parameters:
        props - the default properties
      • getDefaultSerializationProperties

        public java.util.Properties getDefaultSerializationProperties()
        Get the default output properties. The returned value can be modified in-situ using methods such as Properties.setProperty(String, String) to change the defaults in force for the Configuration.

        The method name is a misnomer, retained for backwards compatibility. A SerializationProperties object contains a set of Properties holding simple properties, together with an optional CharacterMap holding a character map. This method returns the simple properties only. In fact the default properties held in the Configuration only contain simple properties, and never a character map.

        Returns:
        the default output properties.
      • obtainDefaultSerializationProperties

        public SerializationProperties obtainDefaultSerializationProperties()
        Obtain a default SerializationProperties object.
        Returns:
        the default serialization properties. This is obtained by wrapping the default output properties maintained in the Configuration within a SerializationProperties wrapper. The returned value can be modified in-situ using methods such as SerializationProperties.setProperty(String, String) to change the defaults in force for the Configuration.
      • processResultDocument

        public void processResultDocument​(ResultDocument instruction,
                                          Expression content,
                                          XPathContext context)
                                   throws XPathException
        Process an xsl:result-document instruction. The Saxon-HE version of this method simply executes the instruction. The Saxon-EE version starts a new thread, and executes the instruction in that thread.
        Parameters:
        instruction - the instruction to be executed
        content - the expression that defines the content of the new result document
        context - the evaluation context
        Throws:
        XPathException - if any dynamic error occurs
      • getMultithreadedItemMappingIterator

        public SequenceIterator getMultithreadedItemMappingIterator​(SequenceIterator base,
                                                                    ItemMappingFunction action)
                                                             throws XPathException
        Get an item mapping iterator suitable for multi-threaded execution, if this is permitted
        Parameters:
        base - iterator over the input sequence
        action - mapping function to be applied to each item in the input sequence.
        Returns:
        an iterator over the result sequence
        Throws:
        XPathException - if (for example) a dynamic error occurs while priming the queue
      • isTiming

        public boolean isTiming()
        Determine whether brief progress messages and timing information will be output.

        This method is provided largely for internal use. Progress messages are normally controlled directly from the command line interfaces, and are not normally used when driving Saxon from the Java API.

        Returns:
        true if these messages are to be output.
      • setTiming

        public void setTiming​(boolean timing)
        Determine whether brief progress messages and timing information will be output.

        This method is provided largely for internal use. Progress messages are normally controlled directly from the command line interfaces, and are not normally used when running from a Java application.

        The name of the method is poorly chosen, since many of the progress messages that are output have little to do with timing or instrumentation.

        If enabled, the relevant messages will be sent either to the destination set using setLogger(Logger) or to the destination set using setStandardErrorOutput(PrintStream), depending on the message.

        Parameters:
        timing - true if these messages are to be output.
      • isVersionWarning

        public boolean isVersionWarning()
        Deprecated.
        since 10.0; the method has had no effect since Saxon 9.8
        Determine whether a warning is to be output when running against a stylesheet labelled as version="1.0". The XSLT specification requires such a warning unless the user disables it.
        Returns:
        always false.
        Since:
        8.4
      • setVersionWarning

        public void setVersionWarning​(boolean warn)
        Deprecated.
        since 10.0; the method has had no effect since Saxon 9.8
        Determine whether a warning is to be output when the version attribute of the stylesheet does not match the XSLT processor version. (In the case where the stylesheet version is "1.0", the XSLT specification requires such a warning unless the user disables it.)
        Parameters:
        warn - ignored.
        Since:
        8.4
      • isValidation

        public boolean isValidation()
        Determine whether the XML parser for source documents will be asked to perform validation of source documents
        Returns:
        true if DTD validation is requested.
        Since:
        8.4
      • setValidation

        public void setValidation​(boolean validation)
        Determine whether the XML parser for source documents will be asked to perform DTD validation of source documents
        Parameters:
        validation - true if DTD validation is to be requested.
        Since:
        8.4
      • makeDocumentProjector

        public FilterFactory makeDocumentProjector​(PathMap.PathMapRoot map)
        Create a document projector for a given path map root. Document projection is available only in Saxon-EE, so the Saxon-HE version of this method throws an exception
        Parameters:
        map - a path map root in a path map. This might represent the call to the initial context item for a query, or it might represent a call on the doc() function. The path map contains information about the paths that the query uses within this document.
        Returns:
        a push filter that implements document projection
        Throws:
        java.lang.UnsupportedOperationException - if this is not a schema-aware configuration, or if no Saxon-EE license is available
      • makeDocumentProjector

        public FilterFactory makeDocumentProjector​(XQueryExpression exp)
        Create a document projector for the document supplied as the initial context item in a query. Document projection is available only in Saxon-EE, so the Saxon-HE version of this method throws an exception
        Parameters:
        exp - an XQuery expression. The document projector that is returned will be for the document supplied as the context item to this query.
        Returns:
        a push filter that implements document projection
        Throws:
        java.lang.UnsupportedOperationException - if this is not a schema-aware configuration, or if no Saxon-EE license is available
      • getSchemaValidationMode

        public int getSchemaValidationMode()
        Ask whether source documents (supplied as a StreamSource or SAXSource) should be subjected to schema validation, and if so, in what validation mode
        Returns:
        the schema validation mode previously set using setSchemaValidationMode(), or the default mode Validation.STRIP otherwise.
      • setSchemaValidationMode

        public void setSchemaValidationMode​(int validationMode)
        Say whether source documents (supplied as a StreamSource or SAXSource) should be subjected to schema validation, and if so, in what validation mode. This value may be overridden at the level of a Controller for an individual transformation or query.
        Parameters:
        validationMode - the validation (or construction) mode to be used for source documents. One of Validation.STRIP, Validation.PRESERVE, Validation.STRICT, Validation.LAX
        Since:
        8.4
      • setValidationWarnings

        public void setValidationWarnings​(boolean warn)
        Indicate whether schema validation failures on result documents are to be treated as fatal errors or as warnings. Note that all validation errors are reported to the error() method of the ErrorListener, and processing always continues except when that method chooses to throw an exception. At the end of the document, a fatal error is thrown if (a) there have been any validation errors, and (b) this option is not set.
        Parameters:
        warn - true if schema validation failures are to be treated as warnings; false if they are to be treated as fatal errors.
        Since:
        8.4
      • isValidationWarnings

        public boolean isValidationWarnings()
        Determine whether schema validation failures on result documents are to be treated as fatal errors or as warnings. Note that all validation errors are reported to the error() method of the ErrorListener, and processing always continues except when that method chooses to throw an exception. At the end of the document, a fatal error is thrown if (a) there have been any validation errors, and (b) this option is not set.
        Returns:
        true if validation errors are to be treated as warnings (that is, the validation failure is reported but processing continues as normal); false if validation errors are fatal.
        Since:
        8.4
      • setExpandAttributeDefaults

        public void setExpandAttributeDefaults​(boolean expand)
        Indicate whether attributes that have a fixed or default value are to be expanded when generating a final result tree. By default (and for conformance with the W3C specifications) it is required that fixed and default values should be expanded. However, there are use cases for example when generating XHTML when this serves no useful purpose and merely bloats the output.

        This option can be overridden at the level of a PipelineConfiguration

        Parameters:
        expand - true if fixed and default values are to be expanded as required by the W3C specifications; false if this action is to be disabled. Note that this only affects the validation of final result trees; it is not possible to suppress expansion of fixed or default values on input documents, as this would make the type annotations on input nodes unsound.
        Since:
        9.0
      • isExpandAttributeDefaults

        public boolean isExpandAttributeDefaults()
        Determine whether elements and attributes that have a fixed or default value are to be expanded. This option applies both to DTD-defined attribute defaults and to schema-defined defaults for elements and attributes. If an XML parser is used that does not report whether defaults have been used, this option is ignored.

        This option can be overridden at the level of a PipelineConfiguration

        Returns:
        true if elements and attributes that have a fixed or default value are to be expanded, false if defaults are not to be expanded. The default value is true. Note that the setting "false" is potentially non-conformant with the W3C specifications.
        Since:
        9.0
      • getNamePool

        public NamePool getNamePool()
        Get the target namepool to be used for stylesheets/queries and for source documents.
        Returns:
        the target name pool. If no NamePool has been specified explicitly, the default NamePool is returned.
        Since:
        8.4
      • setNamePool

        public void setNamePool​(NamePool targetNamePool)
        Set the NamePool to be used for stylesheets/queries and for source documents.

        Using this method allows several Configurations to share the same NamePool. This was the normal default arrangement until Saxon 8.9, which changed the default so that each Configuration uses its own NamePool.

        Sharing a NamePool creates a potential bottleneck, since changes to the namepool are synchronized.

        Parameters:
        targetNamePool - The NamePool to be used.
        Since:
        8.4
      • getTypeHierarchy

        public TypeHierarchy getTypeHierarchy()
        Get the TypeHierarchy: a cache holding type information
        Returns:
        the type hierarchy cache
      • getTypeChecker

        public TypeChecker getTypeChecker​(boolean backwardsCompatible)
        Get an appropriate type-checker. The type-checker that is returned depends on whether backwards compatible (XPath 1.0) mode is enabled (which requires Saxon-PE or higher)
        Parameters:
        backwardsCompatible - set to true if XPath 1.0 compatibility mode is required
        Returns:
        a suitable TypeChecker
      • makeTypeAliasManager

        public TypeAliasManager makeTypeAliasManager()
        Make a TypeAliasManager appropriate to the type of Configuration
        Returns:
        a new TypeAliasManager
      • getDocumentNumberAllocator

        public DocumentNumberAllocator getDocumentNumberAllocator()
        Get the document number allocator.

        The document number allocator is used to allocate a unique number to each document built under this configuration. The document number forms the basis of all tests for node identity; it is therefore essential that when two documents are accessed in the same XPath expression, they have distinct document numbers. Normally this is ensured by building them under the same Configuration. Using this method together with setDocumentNumberAllocator(net.sf.saxon.tree.util.DocumentNumberAllocator), however, it is possible to have two different Configurations that share a single DocumentNumberAllocator

        Returns:
        the current DocumentNumberAllocator
        Since:
        9.0
      • setDocumentNumberAllocator

        public void setDocumentNumberAllocator​(DocumentNumberAllocator allocator)
        Set the document number allocator.

        The document number allocator is used to allocate a unique number to each document built under this configuration. The document number forms the basis of all tests for node identity; it is therefore essential that when two documents are accessed in the same XPath expression, they have distinct document numbers. Normally this is ensured by building them under the same Configuration. Using this method together with getDocumentNumberAllocator(), however, it is possible to have two different Configurations that share a single DocumentNumberAllocator

        This method is for advanced applications only. Misuse of the method can cause problems with node identity. The method should not be used except while initializing a Configuration, and it should be used only to arrange for two different configurations to share the same DocumentNumberAllocators. In this case they should also share the same NamePool.

        Parameters:
        allocator - the DocumentNumberAllocator to be used
        Since:
        9.0
      • isCompatible

        public boolean isCompatible​(Configuration other)
        Determine whether two Configurations are compatible. When queries, transformations, and path expressions are run, all the Configurations used to build the documents and to compile the queries and stylesheets must be compatible. Two Configurations are compatible if they share the same NamePool and the same DocumentNumberAllocator.
        Parameters:
        other - the other Configuration to be compared with this one
        Returns:
        true if the two configurations are compatible
      • getGlobalDocumentPool

        public DocumentPool getGlobalDocumentPool()
        Get the global document pool. This is used for documents preloaded during query or stylesheet compilation. The user application can preload documents into the global pool, where they will be found if any query or stylesheet requests the specified document using the doc() or document() function.
        Returns:
        the global document pool
        Since:
        9.1
      • isStripsAllWhiteSpace

        public boolean isStripsAllWhiteSpace()
        Determine whether whitespace-only text nodes are to be stripped unconditionally from source documents.
        Returns:
        true if the space stripping rules for the default parseOptions cause whitespace text nodes to be stripped from all elements.
        Since:
        8.4
      • createXMLParser

        public org.xml.sax.XMLReader createXMLParser()
        Get an XML parser for source documents.

        This method is intended primarily for internal use.

        Returns:
        a parser
      • getSourceParser

        public org.xml.sax.XMLReader getSourceParser()
                                              throws javax.xml.transform.TransformerFactoryConfigurationError
        Get a parser for source documents. The parser is allocated from a pool if any are available from the pool: the client should ideally return the parser to the pool after use, so that it can be reused.

        This method is intended primarily for internal use.

        Returns:
        a parser, in which the namespace properties must be set as follows: namespaces=true; namespace-prefixes=false. The DTD validation feature of the parser will be set on or off depending on the setValidation(boolean) setting.
        Throws:
        javax.xml.transform.TransformerFactoryConfigurationError - if a failure occurs configuring the parser for use.
      • reuseSourceParser

        public void reuseSourceParser​(org.xml.sax.XMLReader parser)
        Return a source parser to the pool, for reuse
        Parameters:
        parser - The parser: the caller must not supply a parser that was obtained by any mechanism other than calling the getSourceParser() method. Must not be null.
      • getStyleParser

        public org.xml.sax.XMLReader getStyleParser()
                                             throws javax.xml.transform.TransformerFactoryConfigurationError
        Get the parser for stylesheet documents. This parser is also used for schema documents.

        This method is intended for internal use only.

        Returns:
        an XML parser (a SAX2 parser) that can be used for stylesheets and schema documents
        Throws:
        javax.xml.transform.TransformerFactoryConfigurationError - if an error occurs configuring the parser
      • reuseStyleParser

        public void reuseStyleParser​(org.xml.sax.XMLReader parser)
        Return a stylesheet (or schema) parser to the pool, for reuse
        Parameters:
        parser - The parser: the caller must not supply a parser that was obtained by any mechanism other than calling the getStyleParser() method.
      • loadSchema

        public void loadSchema​(java.lang.String absoluteURI)
                        throws SchemaException
        Simple interface to load a schema document
        Parameters:
        absoluteURI - the absolute URI of the location of the schema document
        Throws:
        SchemaException - if the schema document at the given location cannot be read or is invalid
      • readSchema

        public java.lang.String readSchema​(PipelineConfiguration pipe,
                                           java.lang.String baseURI,
                                           java.lang.String schemaLocation,
                                           java.lang.String expected)
                                    throws SchemaException
        Read a schema from a given schema location

        This method is intended for internal use.

        Parameters:
        pipe - the PipelineConfiguration
        baseURI - the base URI of the instruction requesting the reading of the schema
        schemaLocation - the location of the schema to be read
        expected - The expected targetNamespace of the schema being read, or null if there is no expectation
        Returns:
        the target namespace of the schema; null if no schema has been read
        Throws:
        java.lang.UnsupportedOperationException - when called in the non-schema-aware version of the product
        SchemaException - if the schema cannot be read
      • readMultipleSchemas

        public void readMultipleSchemas​(PipelineConfiguration pipe,
                                        java.lang.String baseURI,
                                        java.util.Collection<java.lang.String> schemaLocations,
                                        java.lang.String expected)
                                 throws SchemaException
        Read schemas from a list of schema locations.

        This method is intended for internal use.

        Parameters:
        pipe - the pipeline configuration
        baseURI - the base URI against which the schema locations are to be resolved
        schemaLocations - the relative URIs specified as schema locations
        expected - the namespace URI which is expected as the target namespace of the loaded schema
        Throws:
        SchemaException - if an error occurs
      • readInlineSchema

        public java.lang.String readInlineSchema​(NodeInfo root,
                                                 java.lang.String expected,
                                                 ErrorReporter errorReporter)
                                          throws SchemaException
        Read an inline schema from a stylesheet.

        This method is intended for internal use.

        Parameters:
        root - the xs:schema element in the stylesheet
        expected - the target namespace expected; null if there is no expectation.
        errorReporter - The destination for error messages. May be null, in which case the errorListener registered with this Configuration is used.
        Returns:
        the actual target namespace of the schema
        Throws:
        SchemaException - if the schema cannot be processed
      • needEnterpriseEdition

        protected void needEnterpriseEdition()
        Throw an error indicating that a request cannot be satisfied because it requires the schema-aware edition of Saxon
      • addSchemaSource

        public void addSchemaSource​(javax.xml.transform.Source schemaSource)
                             throws SchemaException
        Load a schema, which will be available for use by all subsequent operations using this Configuration. Any errors will be notified to the ErrorListener associated with this Configuration.
        Parameters:
        schemaSource - the JAXP Source object identifying the schema document to be loaded
        Throws:
        SchemaException - if the schema cannot be read or parsed or if it is invalid
        java.lang.UnsupportedOperationException - if the configuration is not schema-aware
        Since:
        8.4
      • addSchemaSource

        public void addSchemaSource​(javax.xml.transform.Source schemaSource,
                                    ErrorReporter errorReporter)
                             throws SchemaException
        Load a schema, which will be available for use by all subsequent operations using this EnterpriseConfiguration.
        Parameters:
        schemaSource - the JAXP Source object identifying the schema document to be loaded
        errorReporter - the ErrorListener to be notified of any errors in the schema.
        Throws:
        SchemaException - if the schema cannot be read or parsed or if it is invalid
      • addSchemaForBuiltInNamespace

        public void addSchemaForBuiltInNamespace​(java.lang.String namespace)
        Add a built-in schema for a given namespace. This is a no-op if the configuration is not schema-aware
        Parameters:
        namespace - the namespace. Currently built-in schemas are available for the XML and FN namespaces
      • isSchemaAvailable

        public boolean isSchemaAvailable​(java.lang.String targetNamespace)
        Determine whether the Configuration contains a cached schema for a given target namespace
        Parameters:
        targetNamespace - the target namespace of the schema being sought (supply "" for the unnamed namespace)
        Returns:
        true if the schema for this namespace is available, false if not.
      • clearSchemaCache

        public void clearSchemaCache()
        Remove all schema components that have been loaded into this Configuration. This method must not be used if any processes (such as stylesheet or query compilations or executions) are currently active. In a multi-threaded environment, it is the user's responsibility to ensure that this method is not called unless it is safe to do so.
      • getImportedNamespaces

        public java.util.Set<java.lang.String> getImportedNamespaces()
        Get the set of namespaces of imported schemas
        Returns:
        a Set whose members are the namespaces of all schemas in the schema cache, as String objects
      • sealNamespace

        public void sealNamespace​(java.lang.String namespace)
        Mark a schema namespace as being sealed. This is done when components from this namespace are first used for validating a source document or compiling a source document or query. Once a namespace has been sealed, it is not permitted to change the schema components in that namespace by redefining them, deriving new types by extension, or adding to their substitution groups.
        Parameters:
        namespace - the namespace URI of the components to be sealed
      • getDeclaredSchemaParameters

        public java.util.Collection<GlobalParam> getDeclaredSchemaParameters()
        Get the set of saxon:param schema parameters declared in the schema held by this Configuration.
        Returns:
        the set of parameters. May return null if none have been declared.
      • getExtensionsOfType

        public java.util.Iterator<? extends SchemaType> getExtensionsOfType​(SchemaType type)
        Get the set of complex types that have been defined as extensions of a given type. Note that we do not seal the schema namespace, so this list is not necessarily final; we must assume that new extensions of built-in simple types can be added at any time
        Parameters:
        type - the type whose extensions are required
        Returns:
        an iterator over the types that are derived from the given type by extension
      • importComponents

        public void importComponents​(javax.xml.transform.Source source)
                              throws XPathException
        Import a precompiled Schema Component Model from a given Source. The schema components derived from this schema document are added to the cache of schema components maintained by this SchemaManager
        Parameters:
        source - the XML file containing the schema component model, as generated by a previous call on exportComponents(net.sf.saxon.event.Receiver)
        Throws:
        XPathException - if an error occurs
      • exportComponents

        public void exportComponents​(Receiver out)
                              throws XPathException
        Export a precompiled Schema Component Model containing all the components (except built-in components) that have been loaded into this Processor.
        Parameters:
        out - the destination to recieve the precompiled Schema Component Model in the form of an XML document
        Throws:
        XPathException - if a failure occurs
      • getSchemaAsFunctionItem

        public Function getSchemaAsFunctionItem()
        Get information about the schema in the form of a function item. Supports the extension function saxon:schema
        Returns:
        null for a non-schema-aware configuration
      • getSchemaComponentAsFunctionItem

        public Function getSchemaComponentAsFunctionItem​(java.lang.String kind,
                                                         QNameValue name)
                                                  throws XPathException
        Get information about the schema in the form of a function item. Supports the extension function saxon:schema
        Parameters:
        kind - the component kind, e.g. "element declaration"
        name - the component name
        Returns:
        null for a non-schema-aware configuration
        Throws:
        XPathException - if an error occurs
      • getElementDeclaration

        public SchemaDeclaration getElementDeclaration​(int fingerprint)
        Get a global element declaration by fingerprint
        Parameters:
        fingerprint - the NamePool fingerprint of the element name
        Returns:
        the element declaration whose name matches the given fingerprint, or null if no element declaration with this name has been registered.
      • getElementDeclaration

        public SchemaDeclaration getElementDeclaration​(StructuredQName qName)
        Get a global element declaration by name.
        Parameters:
        qName - the name of the required element declaration
        Returns:
        the element declaration whose name matches the given name, or null if no element declaration with this name has been registered.
      • getAttributeDeclaration

        public SchemaDeclaration getAttributeDeclaration​(int fingerprint)
        Get a global attribute declaration by fingerprint
        Parameters:
        fingerprint - the NamePool fingerprint of the element name
        Returns:
        the attribute declaration whose name matches the given fingerprint, or null if no element declaration with this name has been registered.
      • getAttributeDeclaration

        public SchemaDeclaration getAttributeDeclaration​(StructuredQName attributeName)
        Get a global attribute declaration by name
        Parameters:
        attributeName - the name of the required attribute declaration
        Returns:
        the attribute declaration whose name matches the given fingerprint, or null if no element declaration with this name has been registered.
      • getSchemaType

        public SchemaType getSchemaType​(StructuredQName name)
        Get the top-level schema type definition with a given QName.
        Parameters:
        name - the name of the required schema type
        Returns:
        the schema type , or null if there is none with this name.
        Since:
        9.7
      • makeUserUnionType

        public ItemType makeUserUnionType​(java.util.List<AtomicType> memberTypes)
        Make a union type with a given list of member types
        Parameters:
        memberTypes - the member types
        Returns:
        null for a Saxon-HE or -PE Configuration
      • isDeclaredNotation

        public boolean isDeclaredNotation​(java.lang.String uri,
                                          java.lang.String local)
        Ask whether a given notation has been declared in the schema
        Specified by:
        isDeclaredNotation in interface NotationSet
        Parameters:
        uri - the targetNamespace of the notation
        local - the local part of the notation name
        Returns:
        true if the notation has been declared, false if not
        Since:
        9.3
      • checkTypeDerivationIsOK

        public void checkTypeDerivationIsOK​(SchemaType derived,
                                            SchemaType base,
                                            int block)
                                     throws SchemaException
        Check that a type is validly derived from another type, following the rules for the Schema Component Constraint "Is Type Derivation OK (Simple)" (3.14.6) or "Is Type Derivation OK (Complex)" (3.4.6) as appropriate.
        Parameters:
        derived - the derived type
        base - the base type; the algorithm tests whether derivation from this type is permitted
        block - the derivations that are blocked by the relevant element declaration
        Throws:
        SchemaException - if the derivation is not allowed
      • prepareValidationReporting

        public void prepareValidationReporting​(XPathContext context,
                                               ParseOptions options)
        Set validation reporting options. Called by instructions that invoke validation to set up an appropriate invalidity handler
        Parameters:
        context - the XPath evaluation context
        options - the parser options, to be updated
      • getDocumentValidator

        public Receiver getDocumentValidator​(Receiver receiver,
                                             java.lang.String systemId,
                                             ParseOptions validationOptions,
                                             Location initiatingLocation)
        Get a document-level validator to add to a Receiver pipeline.

        This method is intended for internal use.

        Parameters:
        receiver - The receiver to which events should be sent after validation
        systemId - the base URI of the document being validated
        validationOptions - Supplies options relevant to XSD validation
        initiatingLocation - The location of the expression that requested validation
        Returns:
        A Receiver to which events can be sent for validation
      • getElementValidator

        public Receiver getElementValidator​(Receiver receiver,
                                            ParseOptions validationOptions,
                                            Location locationId)
                                     throws XPathException
        Get a Receiver that can be used to validate an element, and that passes the validated element on to a target receiver. If validation is not supported, the returned receiver will be the target receiver.

        This method is intended for internal use.

        Parameters:
        receiver - the target receiver tp receive the validated element
        validationOptions - options affecting the way XSD validation is done
        locationId - current location in the stylesheet or query
        Returns:
        The target receiver, indicating that with this configuration, no validation is performed.
        Throws:
        XPathException - if a validator for the element cannot be created
      • getAnnotationStripper

        public Receiver getAnnotationStripper​(Receiver destination)
        Add to a pipeline a receiver that strips all type annotations. This has a null implementation in the Saxon-HE product, because type annotations can never arise.

        This method is intended for internal use.

        Parameters:
        destination - the Receiver that events will be written to after whitespace stripping
        Returns:
        the Receiver to which events should be sent for stripping
      • makeParser

        public org.xml.sax.XMLReader makeParser​(java.lang.String className)
                                         throws javax.xml.transform.TransformerFactoryConfigurationError
        Create a new SAX XMLReader object using the class name provided.

        The named class must exist and must implement the org.xml.sax.XMLReader or Parser interface.

        This method returns an instance of the parser named.

        This method is intended for internal use.

        Parameters:
        className - A string containing the name of the SAX parser class, for example "com.microstar.sax.LarkDriver"
        Returns:
        an instance of the Parser class named, or null if it is not loadable or is not a Parser.
        Throws:
        javax.xml.transform.TransformerFactoryConfigurationError - if a failure occurs configuring the parser of this class
      • newExpressionParser

        public XPathParser newExpressionParser​(java.lang.String language,
                                               boolean updating,
                                               int languageVersion)
                                        throws XPathException
        Make an expression Parser for a specified version of XPath or XQuery
        Parameters:
        language - set to "XP" (XPath) or "XQ" (XQuery) or "PATTERN" (XSLT Patterns)
        updating - indicates whether or not XQuery update syntax may be used. Note that XQuery Update is supported only in Saxon-EE
        languageVersion - the required version (e.g 10 for "1.0", 30 for "3.0", 31 for "3.1"). A request for XQuery 1.0 or 3.0 delivers an XQuery 3.1 parser. The values supported for XPath are 20 (=2.0), 30 (=3.0), 31 (=3.1), and 305 (=XPath 3.0 plus the syntax extensions defined in XSLT 3.0).
        Returns:
        the QueryParser
        Throws:
        XPathException - if this version of Saxon does not support the requested options
      • newExpressionExporter

        public ExpressionPresenter newExpressionExporter​(java.lang.String target,
                                                         java.io.OutputStream destination,
                                                         StylesheetPackage rootPackage)
                                                  throws XPathException
        Get a new ExpressionPresenter capable of exporting a compiled stylesheet
        Parameters:
        target - the target environment, e.g. EE, JS
        destination - the destination for the output file
        rootPackage - the root package of the export
        Returns:
        a suitable Expression Presenter
        Throws:
        XPathException - if none is available (e.g. because this is not Saxon-EE)
      • setDebugger

        public void setDebugger​(Debugger debugger)
        Set the debugger to be used.

        This method is provided for advanced users only, and is subject to change.

        Parameters:
        debugger - the debugger to be used, or null if no debugger is to be used
      • getDebugger

        public Debugger getDebugger()
        Get the debugger in use. This will be null if no debugger has been registered.

        This method is provided for advanced users only, and is subject to change.

        Returns:
        the debugger in use, or null if none is in use
      • makeSlotManager

        public SlotManager makeSlotManager()
        Factory method to create a SlotManager.

        This method is provided for advanced users only, and is subject to change.

        Returns:
        a SlotManager (which is a skeletal stack frame representing the mapping of variable names to slots on the stack frame)
      • makeStreamingTransformer

        public Receiver makeStreamingTransformer​(Mode mode,
                                                 ParameterSet ordinaryParams,
                                                 ParameterSet tunnelParams,
                                                 Outputter output,
                                                 XPathContext context)
                                          throws XPathException
        Create a streaming transformer
        Parameters:
        mode - the initial mode, which must be a streaming mode
        ordinaryParams - the parameters that are not tunnel parameters
        tunnelParams - the tunnel parameters
        output - the destination for the result
        context - the initial XPath context
        Returns:
        a Receiver to which the streamed input document will be pushed
        Throws:
        XPathException - if a streaming transformer cannot be created (which is always the case in Saxon-HE and Saxon-PE)
      • getFocusTrackerFactory

        public java.util.function.Function<SequenceIterator,​FocusTrackingIterator> getFocusTrackerFactory​(Executable exec,
                                                                                                                boolean multithreaded)
        Get a factory function that can be used to wrap a SequenceIterator in a FocusTrackingIterator. This is called by the Controller to get a default factory function; the value can be overridden by the application using Controller.setFocusTrackerFactory(java.util.function.Function). The FocusTrackingIterator that is created by the factory must be thread-safe if it is to be used for iterating over a sequence where the items might be processed asynchronously using xsl:result-document; for this reason this method is overridden for a Saxon-EE configuration.
        Parameters:
        exec - the executable; supplied so that the factory can be sensitive to whether calls on xsl:result-document are possible
        multithreaded - set to true to get a factory suitable for creating focus tracking iterators for a multi-threaded xsl:for-each instruction
        Returns:
        a suitable factory function
      • isStreamedNode

        public boolean isStreamedNode​(NodeInfo node)
        Ask whether a given node is a streamed node
        Parameters:
        node - the node in question
        Returns:
        true if the node is a node in a streamed document
      • getOptimizerOptions

        public OptimizerOptions getOptimizerOptions()
        Get the optimization options in use
        Returns:
        the configured optimization options
      • obtainOptimizer

        public Optimizer obtainOptimizer()
        Factory method to get an Optimizer.

        This method is intended for internal use only.

        Returns:
        the optimizer used in this configuration, which is created if necessary
      • obtainOptimizer

        public Optimizer obtainOptimizer​(OptimizerOptions options)
        Factory method to get an Optimizer with specified optimizer options.

        This method is intended for internal use only.

        Parameters:
        options - the optimizer options
        Returns:
        a new optimizer with the specified options set (provided the optimizations are available in this Saxon configuration)
      • makeContextItemStaticInfo

        public ContextItemStaticInfo makeContextItemStaticInfo​(ItemType itemType,
                                                               boolean maybeUndefined)
        Factory method to make a ContextItemStaticInfo
        Parameters:
        itemType - the item type of the context item. If the context item is absent, set this to ErrorType.getInstance().
        maybeUndefined - set to true if it is possible (or certain) that the context item will be absent.
        Returns:
        the ContextItemStaticInfo
      • getDefaultContextItemStaticInfo

        public ContextItemStaticInfo getDefaultContextItemStaticInfo()
        Get a default ContextItemStaticInfo, indication no information is available about the context item type
        Returns:
        the default ContextItemStaticInfo
      • makeXQueryExpression

        public XQueryExpression makeXQueryExpression​(Expression exp,
                                                     QueryModule mainModule,
                                                     boolean streaming)
                                              throws XPathException
        Factory method to make an XQueryExpression
        Parameters:
        exp - the expression forming the body of the query
        mainModule - the query module containing the expression
        streaming - true if streamed execution is requested
        Returns:
        the XQueryExpression
        Throws:
        XPathException - if an error occurs
      • makeClosure

        public Sequence makeClosure​(Expression expression,
                                    int ref,
                                    XPathContext context)
                             throws XPathException
        Make a Closure, given the expected reference count
        Parameters:
        expression - the expression to be evaluated
        ref - the (nominal) number of times the value of the expression is required
        context - the XPath dynamic evaluation context
        Returns:
        the constructed Closure
        Throws:
        XPathException - if a failure occurs constructing the Closure
      • makeSequenceExtent

        public GroundedValue makeSequenceExtent​(Expression expression,
                                                int ref,
                                                XPathContext context)
                                         throws XPathException
        Make a SequenceExtent, given the expected reference count
        Parameters:
        expression - the expression to be evaluated
        ref - the (nominal) number of times the value of the expression is required
        context - the XPath dynamic evaluation context
        Returns:
        the constructed SequenceExtent
        Throws:
        XPathException - if evaluation of the expression fails
      • makeStyleNodeFactory

        public StyleNodeFactory makeStyleNodeFactory​(Compilation compilation)
        Factory method to make the StyleNodeFactory, used for constructing elements in a stylesheet document
        Parameters:
        compilation - the compilation episode (compiling one package)
        Returns:
        the StyleNodeFactory used in this Configuration
      • makeStylesheetPackage

        public StylesheetPackage makeStylesheetPackage()
        Factory method to make a StylesheetPackage
        Returns:
        a StylesheetPackage suitable for use in this Configuration
      • makeAccumulatorRegistry

        public AccumulatorRegistry makeAccumulatorRegistry()
        Factory method to make the AccumulatorRegistry, used for static information about the accumulators defined in a package
        Returns:
        a new AccumulatorRegistry appropriate to this Configuration
      • registerExternalObjectModel

        public void registerExternalObjectModel​(ExternalObjectModel model)
        Register an external object model with this Configuration.
        Parameters:
        model - The external object model. This can either be one of the system-supplied external object models for JDOM, XOM, or DOM, or a user-supplied external object model.
        See Also:
        AxiomObjectModel, DOM4JObjectModel, JDOM2ObjectModel, XOMObjectModel
      • getExternalObjectModel

        public ExternalObjectModel getExternalObjectModel​(java.lang.String uri)
        Get the external object model with a given URI, if registered
        Parameters:
        uri - the identifying URI of the required external object model
        Returns:
        the requested external object model if available, or null otherwise
      • getExternalObjectModel

        public ExternalObjectModel getExternalObjectModel​(java.lang.Class<?> nodeClass)
        Get the external object model that recognizes a particular class of node, if available
        Parameters:
        nodeClass - the class of the Node object in the external object model
        Returns:
        the requested external object model if available, or null otherwise
      • getExternalObjectModels

        public java.util.List<ExternalObjectModel> getExternalObjectModels()
        Get all the registered external object models.

        This method is intended for internal use only.

        Returns:
        a list of external object models supported. The members of the list are of type ExternalObjectModel
      • getJavaExternalObjectType

        public JavaExternalObjectType getJavaExternalObjectType​(java.lang.Class<?> theClass)
        Get the JavaExternalObjectType object representing a particular Java class
        Parameters:
        theClass - the class in question
        Returns:
        the corresponding JavaExternalObjectType
      • makeMethodMap

        public java.util.Map<java.lang.String,​Function> makeMethodMap​(java.lang.Class javaClass,
                                                                            java.lang.String required)
        Make a map representing the methods defined in a class. This map is specific to the class, not to a particular instance. The functions present in this map take an extra first argument representing the target instance; the functions returned in the final instance-level map will be partial applications of the functions in the class-level map.
        Parameters:
        javaClass - the Java class whose methods are required
        required - if non-null, indicates the key of the entry that is required in the map. If this parameter is supplied, then the map will be limited to a single entry with this key, since it is known that the other entries would never be used
        Returns:
        a map whose entries represent public instance-level methods in the supplied Java class, to the extent that these methods have unique names.
        Throws:
        java.lang.UnsupportedOperationException - except in subclasses
      • externalObjectAsMap

        public MapItem externalObjectAsMap​(ObjectValue<?> value,
                                           java.lang.String required)
        Convert a Java object to a map
        Parameters:
        value - the (wrapped) Java object to be converted
        required - if non-null, indicates the key of the entry that is required in the map. If this parameter is supplied, then the map will be limited to a single entry with this key, since it is known that the other entries would never be used.
        Returns:
        an XDM map containing entries representing the public instance-level methods available in the object, to the extent that they have unique names.
        Throws:
        java.lang.UnsupportedOperationException - except in subclasses
      • makeObjectLookupExpression

        public Expression makeObjectLookupExpression​(Expression lhs,
                                                     Expression rhs)
                                              throws XPathException
        Make an object lookup expression: supports the construct X?Y where X is an external Java object. Requires Saxon-PE or higher
        Parameters:
        lhs - the left-hand operand
        rhs - the right-hand operand
        Returns:
        the constructed expression
        Throws:
        XPathException - if anything goes wrong
      • unravel

        public NodeInfo unravel​(javax.xml.transform.Source source)
        Get a NodeInfo corresponding to a DOM or other external Node, either by wrapping or unwrapping the external Node.

        This method is intended for internal use.

        Parameters:
        source - A Source representing the wrapped or unwrapped external Node. This will typically be a DOMSource, but it may be a similar Source recognized by some other registered external object model.
        Returns:
        If the Source is a DOMSource and the underlying node is a wrapper around a Saxon NodeInfo, returns the wrapped Saxon NodeInfo. If the Source is a DOMSource and the undelying node is not such a wrapper, returns a new Saxon NodeInfo that wraps the DOM Node. If the Source is any other kind of source, it is offered to each registered external object model for similar treatment. The result is the NodeInfo object obtained by wrapping or unwrapping the supplied external node.
        Throws:
        java.lang.IllegalArgumentException - if the source object is not of a recognized class. This method does not call the registered to resolve the Source.
      • isExtensionElementAvailable

        public boolean isExtensionElementAvailable​(StructuredQName qName)
        Ask whether an extension element with a particular name is available
        Parameters:
        qName - the extension element name
        Returns:
        false (always, in the case of Saxon-HE)
        Since:
        9.7
      • setStaticQueryContextFactory

        public void setStaticQueryContextFactory​(StaticQueryContextFactory factory)
        Set the StaticQueryContextFactory used for creating instances of StaticQueryContext
        Parameters:
        factory - the factory class to be used when a new StaticQueryContext is required. Note that this is not used for the default StaticQueryContext held in the Configuration itself.
        Since:
        9.5.1.2
      • newStaticQueryContext

        public StaticQueryContext newStaticQueryContext()
        Get a new StaticQueryContext (which is also the factory class for creating a query parser). Note that this method is used to underpin the s9api and XQJ APIs for XQuery compilation, and that modifying the behaviour of the StaticQueryContext can affect the behaviour of those APIs
        Returns:
        a new StaticQueryContext
      • newPendingUpdateList

        public PendingUpdateList newPendingUpdateList()
        Get a new Pending Update List
        Returns:
        the new Pending Update List
        Throws:
        java.lang.UnsupportedOperationException - if called when using Saxon-HE
      • makePipelineConfiguration

        public PipelineConfiguration makePipelineConfiguration()
        Make a PipelineConfiguration from the properties of this Configuration
        Returns:
        a new PipelineConfiguration
        Since:
        8.4
      • makeSchemaURIResolver

        public SchemaURIResolver makeSchemaURIResolver​(javax.xml.transform.URIResolver resolver)
        Make a SchemaURIResolver that wraps a supplied URIResolver
        Returns:
        a new SchemaURIResolver (or null if this is not an EnterpriseConfiguration)
        Since:
        10.0
      • getConfiguration

        public static Configuration getConfiguration​(XPathContext context)
        Get the configuration, given the context. This is provided as a static method to make it accessible as an extension function.
        Parameters:
        context - the XPath dynamic context
        Returns:
        the Saxon Configuration for a given XPath dynamic context
      • setSourceResolver

        public void setSourceResolver​(SourceResolver resolver)
        Supply a SourceResolver. This is used for handling unknown implementations of the Source interface: a user-supplied SourceResolver can handle such Source objects and translate them to a kind of Source that Saxon understands.
        Parameters:
        resolver - the source resolver.
      • getSourceResolver

        public SourceResolver getSourceResolver()
        Get the current SourceResolver. If none has been supplied, a system-defined SourceResolver is returned.
        Returns:
        the current SourceResolver
      • resolveSource

        public javax.xml.transform.Source resolveSource​(javax.xml.transform.Source source,
                                                        Configuration config)
                                                 throws XPathException
        Resolve a Source.
        Specified by:
        resolveSource in interface SourceResolver
        Parameters:
        source - A source object, typically the source supplied as the first argument to Transformer.transform(javax.xml.transform.Source, javax.xml.transform.Result) or similar methods.
        config - The Configuration. This provides the SourceResolver with access to configuration information; it also allows the SourceResolver to invoke the resolveSource() method on the Configuration object as a fallback implementation.
        Returns:
        a source object that Saxon knows how to process. This must be an instance of one of the classes StreamSource, SAXSource, DOMSource, AugmentedSource, NodeInfo, or PullSource. Return null if the Source object is not recognized
        Throws:
        XPathException - if the Source object is recognized but cannot be processed
      • buildDocumentTree

        public TreeInfo buildDocumentTree​(javax.xml.transform.Source source)
                                   throws XPathException
        Build a document tree, using options set on this Configuration and on the supplied source object. Options set on the source object override options set in the Configuration. The Source object must be one of the kinds of source recognized by Saxon, or a source that can be resolved using the registered SourceResolver. This method always constructs a new tree, it never wraps or returns an existing tree.
        Parameters:
        source - the Source to be used. This may be an AugmentedSource, allowing options to be specified for the way in which this document will be built. If an AugmentedSource is supplied then options set in the AugmentedSource take precedence over options set in the Configuration.

        If any error occurs reading or parsing the supplied Source, the error is notified to the ErrorListener registered with this Configuration.

        Returns:
        the constructed document as a TreeInfo
        Throws:
        XPathException - if any errors occur during document parsing or validation. Detailed errors occurring during schema validation will be written to the ErrorListener associated with the AugmentedSource, if supplied, or with the Configuration otherwise.
        Since:
        9.7; based on the original buildDocument(Source) method, but adapted to return the TreeInfo containing information about the constructed tree, including a reference to its root node.
      • buildDocumentTree

        public TreeInfo buildDocumentTree​(javax.xml.transform.Source source,
                                          ParseOptions parseOptions)
                                   throws XPathException
        Build a document, using specified options for parsing and building. This method always constructs a new tree, it never wraps an existing document (regardless of anything in the parseOptions)
        Parameters:
        source - the source of the document to be constructed. If this is an AugmentedSource, then any parser options contained in the AugmentedSource take precedence over options specified in the parseOptions argument.
        parseOptions - options for parsing and constructing the document. Any options that are not explicitly set in parseOptions default first to the values supplied in the source argument if it is an AugmentedSource, and then to the values set in this Configuration. The supplied parseOptions object is not modified.
        Returns:
        the constructed document as a TreeInfo
        Throws:
        XPathException - if parsing fails, or if the Source represents a node other than a document node
        Since:
        9.7; based on the original buildDocument(Source, ParseOptions) method, but adapted to return the TreeInfo containing information about the constructed tree, including a reference to its root node.
      • getTreeStatistics

        public TreeStatistics getTreeStatistics()
        Get the collection of tree-builder statistics for this configuration, used for learning suitable amounts of space to allocate for different kinds of tree
        Returns:
        the object in which tree statistics are accumulated
      • makeEmitter

        public Receiver makeEmitter​(java.lang.String clarkName,
                                    java.util.Properties props)
                             throws XPathException
        Load a named output emitter or SAX2 ContentHandler and check it is OK.
        Parameters:
        clarkName - the QName of the user-supplied ContentHandler (requested as a prefixed value of the method attribute in xsl:output, or anywhere that serialization parameters are allowed), encoded in Clark format as {uri}local
        props - the properties to be used in the case of a dynamically-loaded ContentHandler.
        Returns:
        a Receiver (despite the name, it is not required to be an Emitter)
        Throws:
        XPathException - if a failure occurs creating the Emitter
      • setConfigurationProperty

        public void setConfigurationProperty​(java.lang.String name,
                                             java.lang.Object value)
        Set a property of the configuration. This method underpins the setAttribute() method of the TransformerFactory implementation, and is provided to enable setting of Configuration properties using URIs without instantiating a TransformerFactory: specifically, this may be useful when running XQuery, and it is also used by the Validator API.

        From Saxon 9.9, an alternative interface is available: setConfigurationProperty(Feature, Object). The new interface is more efficient because it avoids expensive string comparisons. The old interface is retained mainly for compatibility, and also because there are a few cases where it cannot easily be replaced, for example when using composite feature URIs to delegate configuration options to the XML parser.

        Parameters:
        name - the URI identifying the property to be set. See the class FeatureKeys for constants representing the property names that can be set.
        value - the value of the property. Note that boolean values may be supplied either as a Boolean, or as one of the strings "0", "1", "true", "false", "yes", "no", "on", or "off".
        Throws:
        java.lang.IllegalArgumentException - if the property name is not recognized or if the value is not a valid value for the named property
      • setConfigurationProperty

        public <T> void setConfigurationProperty​(Feature<T> feature,
                                                 T value)
        Set a property of the configuration. This method underpins the setAttribute() method of the TransformerFactory implementation, and is provided to enable setting of Configuration properties using URIs without instantiating a TransformerFactory: specifically, this may be useful when running XQuery, and it is also used by the Validator API
        Type Parameters:
        T - the type of value required for this particular feature
        Parameters:
        feature - the property to be set. See the class Feature for constants representing the property names that can be set.
        value - the value of the property. Note that boolean values may be supplied either as a Boolean, or as one of the strings "0", "1", "true", "false", "yes", "no", "on", or "off".
        Throws:
        java.lang.IllegalArgumentException - if the property name is not recognized or if the value is not a valid value for the named property
      • requireBoolean

        public static boolean requireBoolean​(java.lang.String propertyName,
                                             java.lang.Object value)
        Validate a property value where the required type is boolean
        Parameters:
        propertyName - the name of the property
        value - the supplied value of the property. This may be either a java.lang.Boolean, or a string taking one of the values on|off, true|false, yes|no, or 1|0 (suited to the conventions of different configuration APIs that end up calling this method)
        Returns:
        the value as a boolean
        Throws:
        java.lang.IllegalArgumentException - if the supplied value cannot be validated as a recognized boolean value
      • requireInteger

        protected int requireInteger​(java.lang.String propertyName,
                                     java.lang.Object value)
        Validate a property value where the required type is integer
        Parameters:
        propertyName - the name of the property
        value - the supplied value of the property. This may be either a java.lang.Integer, or a string that can be parsed as an integer (suited to the conventions of different configuration APIs that end up calling this method)
        Returns:
        the value as an integer
        Throws:
        java.lang.IllegalArgumentException - if the supplied value cannot be validated as a recognized boolean value
      • internalSetBooleanProperty

        protected void internalSetBooleanProperty​(Feature property,
                                                  java.lang.Object value)
        Set a boolean property value, without checking that it is a recognized property name
        Parameters:
        property - the name of the property to be set
        value - a representation of the boolean value. This may be either a java.lang.Boolean, or a string taking one of the values on|off, true|false, yes|no, or 1|0 (suited to the conventions of different configuration APIs that end up calling this method)
      • getBooleanProperty

        public boolean getBooleanProperty​(Feature<?> feature)
        Get a boolean property of the configuration
        Parameters:
        feature - the integer code of the required property. See the class FeatureCode for constants representing the property names that can be requested. This class only recognizes properties whose type is boolean.
        Returns:
        the value of the property. In the case of an unrecognized property name, the value returned is false: no error is thrown.
      • setBooleanProperty

        public void setBooleanProperty​(java.lang.String propertyName,
                                       boolean value)
        Set a boolean property of the configuration
        Parameters:
        propertyName - the name of the required property. See the class FeatureKeys for constants representing the property names that can be requested. This class only recognizes properties whose type is boolean.
        value - the value of the property.
        Throws:
        java.lang.IllegalArgumentException - if the property name is not recognized (as a property whose expected value is boolean)
      • setBooleanProperty

        public void setBooleanProperty​(Feature<java.lang.Boolean> feature,
                                       boolean value)
        Set a boolean property of the configuration
        Parameters:
        feature - the required property. See the class Feature for constants representing the property names that can be requested. This class only recognizes properties whose type is boolean.
        value - the value of the property.
        Throws:
        java.lang.IllegalArgumentException - if the feature is not recognized (as a feature whose expected value is boolean)
      • requireString

        protected java.lang.String requireString​(java.lang.String propertyName,
                                                 java.lang.Object value)
      • instantiateClassName

        protected java.lang.Object instantiateClassName​(java.lang.String propertyName,
                                                        java.lang.Object value,
                                                        java.lang.Class<?> requiredClass)
      • getConfigurationProperty

        public java.lang.Object getConfigurationProperty​(java.lang.String name)
        Get a property of the configuration
        Parameters:
        name - the name of the required property. See the class FeatureKeys for constants representing the property names that can be requested.
        Returns:
        the value of the property. Note that boolean values are returned as a Boolean, even if the value was supplied as a string (for example "true" or "on").
        Throws:
        java.lang.IllegalArgumentException - thrown if the property is not one that Saxon recognizes.
      • getConfigurationProperty

        public <T> T getConfigurationProperty​(Feature<T> feature)
        Get a property of the configuration
        Type Parameters:
        T - the type of value returned for this particular feature
        Parameters:
        feature - the required property. See the class Feature for constants representing the properties that can be requested.
        Returns:
        the value of the property. Note that boolean values are returned as a Boolean, even if the value was supplied as a string (for example "true" or "on").
        Throws:
        java.lang.IllegalArgumentException - thrown if the property is not one that Saxon recognizes.
        Since:
        9.9
      • isGenerateByteCode

        public boolean isGenerateByteCode​(HostLanguage hostLanguage)
        Ask whether bytecode should be generated. The default setting is true in Saxon Enterprise Edition and false in all other cases. Setting the option to true has no effect if Saxon-EE is not available (but if it is set to true, this method will return true). Setting the option to false in Saxon-EE is permitted if for some reason bytecode generation is to be suppressed (one possible reason is to improve compilation performance at the expense of evaluation performance).
        Parameters:
        hostLanguage - one of XSLT or XQUERY
        Returns:
        true if the option is switched on
      • isDeferredByteCode

        public boolean isDeferredByteCode​(HostLanguage hostLanguage)
        Ask whether bytecode should be generated in Just-In-time compilation and therefore deferring the byte code generation. The default setting is false. Setting the option to true has no effect if Saxon-EE is not available (but if it is set to true, this method will return true). Setting the option to false in Saxon-EE is permitted and therefore byte code generation will be generated in the compile phase.
        Parameters:
        hostLanguage - one of XSLT or XQUERY
        Returns:
        true if the option is switched on
      • isJITEnabled

        public boolean isJITEnabled()
        Ask whether just-in-time compilation of XSLT template rules is in force
        Returns:
        true if just-in-time compilation is enabled (this is the default in Saxon-EE and not available in other configurations)
      • close

        public void close()
        Close any resources held by the Configuration. This implementation closes the Logger and/or trace output file if one has been allocated.
      • makePackageLoader

        public IPackageLoader makePackageLoader()
        Create a package loader, for reloading SEF files, appropriate to the Saxon edition being used
        Returns:
        a package loader
      • createValidityReporter

        public InvalidityReportGenerator createValidityReporter()
        Register a report generator for reporting invalidities detected in the course of schema validation
        Returns:
        a report generator.
        Throws:
        java.lang.UnsupportedOperationException - (always) in Saxon-HE
      • getCountDown

        public int getCountDown()
        Get the threshold for generating byte code
        Returns:
        a value indicating the number of times an expression should be evaluated intepretatively before it is optimized by generating bytecode
      • makeMode

        public SimpleMode makeMode​(StructuredQName modeName,
                                   CompilerInfo compilerInfo)
        Make a new Mode - this can be overridden in subclasses to produce optimized variants
        Parameters:
        modeName - the name of the mode
        compilerInfo - information on the compiler, that can alter rule optimization
        Returns:
        an instantiated Mode
      • makeTemplateRule

        public TemplateRule makeTemplateRule()
        Factory method to create a Template Rule
        Returns:
        a new TemplateRule appropriate to this Configuration
      • makeThreadManager

        public XPathContextMajor.ThreadManager makeThreadManager()
        Make a ThreadManager for asynchronous xsl:result-document instructions
        Returns:
        a new ThreadManager (or null in the case of Saxon-HE)
      • makeCompilerInfo

        public CompilerInfo makeCompilerInfo()
        Make an XSLT CompilerInfo object - can be overridden in a subclass to produce variants capable of optimization
        Returns:
        a new CompilerInfo object
      • makeCompilerService

        public ICompilerService makeCompilerService​(HostLanguage hostLanguage)
        Make a CompilerService object, to handle byte code generation, or null if byte code generation is not available
        Parameters:
        hostLanguage - eg Configuration.XSLT
        Returns:
        a CompilerService, or null
      • createByteCodeReport

        public void createByteCodeReport​(java.lang.String fileName)
        Generate a report on byte code instrumentation to a specified file
        Parameters:
        fileName - the specified file name
      • setLabel

        public void setLabel​(java.lang.String label)
        Set a label for this configuration
        Parameters:
        label - the label to associate
      • getLabel

        public java.lang.String getLabel()
        Get the associated label for this configuration (typically, the value of the @label attribute in the configuration file)
        Returns:
        the associated label