net.sf.saxon
Class Configuration

java.lang.Object
  extended bynet.sf.saxon.Configuration
All Implemented Interfaces:
ConversionContext, java.io.Serializable

public class Configuration
extends java.lang.Object
implements ConversionContext, java.io.Serializable

This class holds details of user-selected configuration options for a transformation or query. 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.

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
See Also:
Serialized Form

Field Summary
static int DO_NOT_RECOVER
          Constant indicating that when a recoverable error occurs, the processor should not attempt to take the defined recovery action, but should terminate with an error.
static int JAVA_APPLICATION
          Constant indicating that the host language is Java: that is, this is a free-standing Java application with no XSLT or XQuery content
protected  javax.xml.transform.ErrorListener listener
           
protected  Optimizer optimizer
           
static int RECOVER_SILENTLY
          Constant indicating that the processor should take the recovery action when a recoverable error occurs, with no warning message.
static int RECOVER_WITH_WARNINGS
          Constant indicating that the processor should produce a warning when a recoverable error occurs, and should then take the recovery action and continue.
protected  int recoveryPolicy
           
protected  VendorFunctionLibrary vendorFunctionLibrary
           
static int XML_SCHEMA
          Constant indicating that the "host language" is XML Schema
static int XPATH
          Constant indicating that the host language is XPATH itself - that is, a free-standing XPath environment
static int XQUERY
          Constant indicating that the host language is XQuery
static int XSLT
          Constant indicating that the host language is XSLT
 
Constructor Summary
Configuration()
          Create a configuration object with default settings for all options
 
Method Summary
 void addSchema(java.lang.Object schema)
          Add a schema to the cache.
 void addSchemaSource(javax.xml.transform.Source schemaSource)
          Load a schema, which will be available for use by all subsequent operations using this Configuration.
 boolean areAllNodesUntyped()
          Determine whether all nodes encountered within this query or transformation are guaranteed to be untyped
 void displayLicenseMessage()
          Display a message about the license status
 ExternalObjectModel findExternalObjectModel(java.lang.Object node)
          Find the external object model corresponding to a given node.
 Receiver getAnnotationStripper(Receiver destination)
          Add to a pipeline a receiver that strips all type annotations.
 SchemaDeclaration getAttributeDeclaration(int fingerprint)
          Get a global attribute declaration.
 java.lang.Class getClass(java.lang.String className, boolean tracing, java.lang.ClassLoader classLoader)
          Load a class using the class name provided.
 java.lang.ClassLoader getClassLoader()
          Get the ClassLoader supplied using the method setClassLoader(java.lang.ClassLoader).
 Debugger getDebugger()
          Get the debugger in use.
 Receiver getDocumentValidator(Receiver receiver, java.lang.String systemId, NamePool namePool, int validationMode)
          Get a document-level validator to add to a Receiver pipeline.
 SchemaDeclaration getElementDeclaration(int fingerprint)
          Get a global element declaration.
 Receiver getElementValidator(Receiver receiver, int nameCode, int locationId, SchemaType schemaType, int validation, NamePool pool)
          Get a Receiver that can be used to validate an element, and that passes the validated element on to a target receiver.
 javax.xml.transform.ErrorListener getErrorListener()
          Get the ErrorListener used in this configuration.
 FunctionLibrary getExtensionBinder()
          Get the FunctionLibrary used to bind calls on extension functions.
 ExtensionFunctionFactory getExtensionFunctionFactory()
          Get an ExtensionFunctionFactory.
 java.util.List getExternalObjectModels()
          Get all the registered external object models.
 int getHostLanguage()
          Get the host language used in this configuration.
 int getImplicitTimezone()
          Get the implicit timezone, as a positive or negative offset from UTC in minutes.
 java.lang.Object getInstance(java.lang.String className, java.lang.ClassLoader classLoader)
          Instantiate a class using the class name provided.
static java.util.Locale getLocale(java.lang.String lang)
          Get a locale given a language code in XML format.
 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.
 NamePool getNamePool()
          Get the target namepool to be used for stylesheets/queries and for source documents.
 Optimizer getOptimizer()
          Factory method to get an Optimizer.
 OutputURIResolver getOutputURIResolver()
          Get the OutputURIResolver that will be used to resolve URIs used in the href attribute of the xsl:result-document instruction.
 java.lang.String getProductTitle()
          Get a message used to identify this product when a transformation is run using the -t option
 int getRecoveryPolicy()
          Determine how recoverable run-time errors are to be handled.
 java.lang.Object getSchema(java.lang.String namespace)
          Get a schema from the cache.
 SchemaType getSchemaType(int fingerprint)
          Get the top-level schema type definition with a given fingerprint.
 int getSchemaValidationMode()
          Determine whether source documents (supplied as a StreamSource or SAXSource) should be subjected to schema validation
 org.xml.sax.XMLReader getSourceParser()
          Get a parser for source documents.
 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).
 org.xml.sax.XMLReader getStyleParser()
          Get the parser for stylesheet documents.
 java.lang.String getStyleParserClass()
          Get the name of the class that will be instantiated to create an XML parser for parsing stylesheet modules.
 TraceListener getTraceListener()
          Get the TraceListener used for run-time tracing of instruction execution.
 int getTreeModel()
          Get the Tree Model used by this Configuration.
 javax.xml.transform.URIResolver getURIResolver()
          Get the URIResolver used in this configuration
 VendorFunctionLibrary getVendorFunctionLibrary()
          Get the FunctionLibrary used to bind calls on Saxon-defined extension functions.
 boolean isAllowExternalFunctions()
          Determine whether calls to external Java functions are permitted.
 boolean isLazyConstructionMode()
          Determine whether lazy construction mode is on or off.
 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.
 boolean isRetainDTDAttributeTypes()
          Determine whether attribute types obtained from a DTD are to be used to set type annotations on the resulting nodes
 boolean isSchemaAware(int language)
          Determine if the configuration is schema-aware, for the given host language
 boolean isStripsAllWhiteSpace()
          Determine whether whitespace-only text nodes are to be stripped unconditionally from source documents.
 boolean isTiming()
          Determine whether brief progress messages and timing information will be output to System.err.
 boolean isTraceExternalFunctions()
          Determine whether calls on external functions are to be traced for diagnostic purposes.
 boolean isValidation()
          Determine whether the XML parser for source documents will be asked to perform DTD validation of source documents
 boolean isValidationWarnings()
          Determine whether schema validation failures on result documents are to be treated as fatal errors or as warnings.
 boolean isVersionWarning()
          Determine whether a warning is to be output when running against a stylesheet labelled as version="1.0".
 java.util.Comparator makeCollator(java.lang.String className)
          Load a named collator class and check it is OK.
 org.xml.sax.XMLReader makeParser(java.lang.String className)
          Create a new SAX XMLReader object using the class name provided.
 PipelineConfiguration makePipelineConfiguration()
          Make a PipelineConfiguration from the properties of this Configuration
 SlotManager makeSlotManager()
          Factory method to create a SlotManager.
 NodeTest makeSubstitutionGroupTest(SchemaDeclaration elementDecl)
          Make a test for elements corresponding to a give element declaration.
 TraceListener makeTraceListener(java.lang.String className)
          Create an instance of a TraceListener with a specified class name
 javax.xml.transform.URIResolver makeURIResolver(java.lang.String className)
          Create an instance of a URIResolver with a specified class name
 java.lang.String readInlineSchema(PipelineConfiguration pipe, NodeInfo root, java.lang.String expected)
          Read an inline schema from a stylesheet.
 void readMultipleSchemas(PipelineConfiguration pipe, java.lang.String baseURI, java.util.List schemaLocations, java.lang.String expected)
          Read schemas from a list of schema locations.
 java.lang.String readSchema(PipelineConfiguration pipe, java.lang.String baseURI, java.lang.String schemaLocation, java.lang.String expected)
          Read a schema from a given schema location
 void registerExternalObjectModel(ExternalObjectModel model)
          Register an external object model.
 void registerStandardObjectModels()
          Register the standard Saxon-supplied object models.
 void setAllNodesUntyped(boolean allUntyped)
          Specify that all nodes encountered within this query or transformation will be untyped
 void setAllowExternalFunctions(boolean allowExternalFunctions)
          Determine whether calls to external Java functions are permitted.
 void setClassLoader(java.lang.ClassLoader loader)
          Set a ClassLoader to be used when loading external classes.
 void setDebugger(Debugger debugger)
          Set the debugger to be used.
 void setErrorListener(javax.xml.transform.ErrorListener listener)
          Set the ErrorListener to be used in this configuration.
 void setExtensionBinder(FunctionLibrary binder)
          Set the FunctionLibrary used to bind calls on extension functions.
 void setExtensionFunctionFactory(ExtensionFunctionFactory factory)
          Set an ExtensionFunctionFactory.
 void setHostLanguage(int hostLanguage)
          Set the host language used in this configuration.
 void setImplicitTimezone(int minutes)
          Set the implicit timezone, as a positive or negative offset from UTC in minutes.
 void setLazyConstructionMode(boolean lazy)
          Set lazy construction mode on or off.
 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.
 void setMessageEmitterClass(java.lang.String messageEmitterClass)
          Set the name of the class that will be instantiated to create a MessageEmitter, to process the output of xsl:message instructions in XSLT.
 void setNamePool(NamePool targetNamePool)
          Set the NamePool to be used for stylesheets/queries and for source documents.
 void setOutputURIResolver(OutputURIResolver outputURIResolver)
          Set the OutputURIResolver that will be used to resolve URIs used in the href attribute of the xsl:result-document instruction.
 void setRecoveryPolicy(int recoveryPolicy)
          Determine how recoverable run-time errors are to be handled.
 void setRetainDTDAttributeTypes(boolean useTypes)
          Determine whether attribute types obtained from a DTD are to be used to set type annotations on the resulting nodes.
 void setSchemaValidationMode(int validationMode)
          Indicate whether source documents (supplied as a StreamSource or SAXSource) should be subjected to schema validation
 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).
 void setStripsAllWhiteSpace(boolean stripsAllWhiteSpace)
          Determine whether whitespace-only text nodes are to be stripped unconditionally from source documents.
 void setStyleParserClass(java.lang.String styleParserClass)
          Set the name of the class that will be instantiated to create an XML parser for parsing stylesheet modules.
 void setTiming(boolean timing)
          Determine whether brief progress messages and timing information will be output to System.err.
 void setTraceExternalFunctions(boolean traceExternalFunctions)
          Determine whether calls on external functions are to be traced for diagnostic purposes.
 void setTraceListener(TraceListener traceListener)
          Set the TraceListener to be used for run-time tracing of instruction execution.
 void setTreeModel(int treeModel)
          Set the Tree Model used by this Configuration.
 void setURIResolver(javax.xml.transform.URIResolver resolver)
          Set the URIResolver to be used in this configuration.
 void setValidation(boolean validation)
          Determine whether the XML parser for source documents will be asked to perform DTD validation of source documents
 void setValidationWarnings(boolean warn)
          Indicate whether schema validation failures on result documents are to be treated as fatal errors or as warnings.
 void setVersionWarning(boolean warn)
          Determine whether a warning is to be output when running against a stylesheet labelled as version="1.0".
 long validateAttribute(int nameCode, java.lang.CharSequence value, int validation)
          Validate an attribute value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

listener

protected transient javax.xml.transform.ErrorListener listener

vendorFunctionLibrary

protected VendorFunctionLibrary vendorFunctionLibrary

recoveryPolicy

protected int recoveryPolicy

optimizer

protected Optimizer optimizer

RECOVER_SILENTLY

public static final int RECOVER_SILENTLY
Constant indicating that the processor should take the recovery action when a recoverable error occurs, with no warning message.

See Also:
Constant Field Values

RECOVER_WITH_WARNINGS

public static final int RECOVER_WITH_WARNINGS
Constant indicating that the processor should produce a warning when a recoverable error occurs, and should then take the recovery action and continue.

See Also:
Constant Field Values

DO_NOT_RECOVER

public static final int DO_NOT_RECOVER
Constant indicating that when a recoverable error occurs, the processor should not attempt to take the defined recovery action, but should terminate with an error.

See Also:
Constant Field Values

XSLT

public static final int XSLT
Constant indicating that the host language is XSLT

See Also:
Constant Field Values

XQUERY

public static final int XQUERY
Constant indicating that the host language is XQuery

See Also:
Constant Field Values

XML_SCHEMA

public static final int XML_SCHEMA
Constant indicating that the "host language" is XML Schema

See Also:
Constant Field Values

JAVA_APPLICATION

public static final int JAVA_APPLICATION
Constant indicating that the host language is Java: that is, this is a free-standing Java application with no XSLT or XQuery content

See Also:
Constant Field Values

XPATH

public static final int XPATH
Constant indicating that the host language is XPATH itself - that is, a free-standing XPath environment

See Also:
Constant Field Values
Constructor Detail

Configuration

public Configuration()
Create a configuration object with default settings for all options

Since:
8.4
Method Detail

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

isSchemaAware

public boolean isSchemaAware(int language)
Determine if the configuration is schema-aware, for the given host language

Parameters:
language - the required host language: XSLT, XQUERY, or XML_SCHEMA
Since:
8.4

displayLicenseMessage

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


getHostLanguage

public int getHostLanguage()
Get the host language used in this configuration. The typical values are XSLT and XQUERY. The values XML_SCHEMA and JAVA_APPLICATION may also be encountered.

This method is problematic because it is possible to run multiple transformations or queries within the same configuration. The method is therefore best avoided. Instead, use Executable.getHostLanguage(). Internally its only use is in deciding (in Saxon-SA only) which error listener to use by default at compile time, and since the standard XSLT and XQuery listeners have no differences when used for static errors, the choice is immaterial.

Returns:
Configuration.XSLT or Configuration.XQUERY

setHostLanguage

public void setHostLanguage(int hostLanguage)
Set the host language used in this configuration. The possible values are XSLT and XQUERY.

Parameters:
hostLanguage - Configuration.XSLT or Configuration.XQUERY

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

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

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

getErrorListener

public javax.xml.transform.ErrorListener getErrorListener()
Get the ErrorListener used in this configuration. If no ErrorListener has been supplied explicitly, the default ErrorListener is used.

Returns:
the ErrorListener.
Since:
8.4

setErrorListener

public void setErrorListener(javax.xml.transform.ErrorListener listener)
Set the ErrorListener to be used in this configuration. The ErrorListener is informed of all static and dynamic errors detected, and can decide whether run-time warnings are to be treated as fatal.

Parameters:
listener - the ErrorListener to be used
Since:
8.4

getTreeModel

public int getTreeModel()
Get the Tree Model used by this Configuration. This is either Builder.STANDARD_TREE or Builder.TINY_TREE. The default (confusingly) is Builder.TINY_TREE.

Returns:
the selected Tree Model
Since:
8.4

setTreeModel

public void setTreeModel(int treeModel)
Set the Tree Model used by this Configuration. This is either Builder.STANDARD_TREE or Builder.TINY_TREE. The default (confusingly) is Builder.TINY_TREE.

Parameters:
treeModel - the selected Tree Model
Since:
8.4

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

getTraceListener

public TraceListener getTraceListener()
Get the TraceListener used for run-time tracing of instruction execution.

Returns:
the TraceListener, or null if none is in use.
Since:
8.4

setTraceListener

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

Parameters:
traceListener - The TraceListener to be used.
Since:
8.4

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

setExtensionBinder

public void setExtensionBinder(FunctionLibrary binder)
Set the FunctionLibrary used to bind calls on extension functions. This allows the rules for identifying extension functions to be customized (in principle, it would allow support for extension functions in other languages to be provided).

When an application supplies its own FunctionLibrary for binding extension functions, this replaces the default binding mechanism for Java extension functions, namely JavaExtensionLibrary. It thus disables the function libraries for built-in Saxon extensions and for EXSLT extensions. It is possible to create a function library that adds to the existing mechanisms, rather than replacing them, by supplying as the FunctionLibrary a FunctionLibraryList that itself contains two FunctionLibrary objects: a JavaExtensionLibrary, and a user-written FunctionLibrary.

This mechanism is recently introduced and is still experimental. It is intended for advanced users only, and the details are subject to change.

Parameters:
binder - The FunctionLibrary object used to locate implementations of extension functions, based on their name and arity
See Also:
setExtensionFunctionFactory(net.sf.saxon.functions.ExtensionFunctionFactory)

getExtensionBinder

public FunctionLibrary getExtensionBinder()
Get the FunctionLibrary used to bind calls on extension functions.

This mechanism is for advanced users only, and the details are subject to change.

Returns:
the registered FunctionLibrary for extension functions if one has been registered; or the default FunctionLibrary for extension functions otherwise

getVendorFunctionLibrary

public VendorFunctionLibrary getVendorFunctionLibrary()
Get the FunctionLibrary used to bind calls on Saxon-defined extension functions.

This method is intended for internal use only.


getRecoveryPolicy

public int getRecoveryPolicy()
Determine how recoverable run-time errors are to be handled. This applies only if the standard ErrorListener is used.

Returns:
the current recovery policy. The options are RECOVER_SILENTLY, RECOVER_WITH_WARNINGS, or DO_NOT_RECOVER.
Since:
8.4

setRecoveryPolicy

public void setRecoveryPolicy(int recoveryPolicy)
Determine how recoverable run-time errors are to be handled. This applies only if the standard ErrorListener is used. The recovery policy applies to errors classified in the XSLT 2.0 specification as recoverable dynamic errors, but only in those cases where Saxon provides a choice over how the error is handled: in some cases, Saxon makes the decision itself.

Parameters:
recoveryPolicy - the recovery policy to be used. The options are RECOVER_SILENTLY, RECOVER_WITH_WARNINGS, or DO_NOT_RECOVER.
Since:
8.4

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 messageEmitterClass)
Set the name of the class that will be instantiated to create a MessageEmitter, to process the output of xsl:message instructions in XSLT.

Parameters:
messageEmitterClass - the full class name of the message emitter class. This must implement net.sf.saxon.event.Emitter.
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 Source 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 Source 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 styleParserClass)
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:
styleParserClass - 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)
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

isTiming

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

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 to System.err.

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

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

isVersionWarning

public boolean isVersionWarning()
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:
true if these messages are to be output.
Since:
8.4

setVersionWarning

public void setVersionWarning(boolean warn)
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.

Parameters:
warn - true if these messages are to be output.
Since:
8.4

isAllowExternalFunctions

public boolean isAllowExternalFunctions()
Determine whether calls to external Java functions are permitted.

Returns:
true if such calls are permitted.
Since:
8.4

setAllowExternalFunctions

public void setAllowExternalFunctions(boolean allowExternalFunctions)
Determine whether calls to external Java functions are permitted. Allowing external function calls is potentially a security risk if the stylesheet or Query is untrusted, as it allows arbitrary Java methods to be invoked, which can examine or modify the contents of filestore and other resources on the machine where the query/stylesheet is executed

Parameters:
allowExternalFunctions - true if external function calls are to be permitted.
Since:
8.4

isTraceExternalFunctions

public boolean isTraceExternalFunctions()
Determine whether calls on external functions are to be traced for diagnostic purposes.

Returns:
true if tracing is enabled for calls to external Java functions

setRetainDTDAttributeTypes

public void setRetainDTDAttributeTypes(boolean useTypes)
                                throws javax.xml.transform.TransformerFactoryConfigurationError
Determine whether attribute types obtained from a DTD are to be used to set type annotations on the resulting nodes.

Parameters:
useTypes - set to true if DTD types are to be taken into account
Throws:
javax.xml.transform.TransformerFactoryConfigurationError
Since:
8.4

isRetainDTDAttributeTypes

public boolean isRetainDTDAttributeTypes()
Determine whether attribute types obtained from a DTD are to be used to set type annotations on the resulting nodes

Returns:
true if DTD types are to be taken into account
Since:
8.4

setTraceExternalFunctions

public void setTraceExternalFunctions(boolean traceExternalFunctions)
Determine whether calls on external functions are to be traced for diagnostic purposes.

Parameters:
traceExternalFunctions - true if tracing is to be enabled for calls to external Java functions

getExtensionFunctionFactory

public ExtensionFunctionFactory getExtensionFunctionFactory()
Get an ExtensionFunctionFactory. This is used at compile time for generating the code that calls Java extension functions. It is possible to supply a user-defined ExtensionFunctionFactory to customize the way extension functions are bound.

This mechanism is intended for advanced use only, and is subject to change.

Returns:
the factory object registered to generate calls on extension functions, if one has been registered; if not, the default factory used by Saxon.

setExtensionFunctionFactory

public void setExtensionFunctionFactory(ExtensionFunctionFactory factory)
Set an ExtensionFunctionFactory. This is used at compile time for generating the code that calls Java extension functions. It is possible to supply a user-defined ExtensionFunctionFactory to customize the way extension functions are called. The ExtensionFunctionFactory determines how external methods are called, but is not involved in binding the external method corresponding to a given function name or URI.

This mechanism is intended for advanced use only, and is subject to change.

See Also:
setExtensionBinder(net.sf.saxon.functions.FunctionLibrary)

isValidation

public boolean isValidation()
Determine whether the XML parser for source documents will be asked to perform DTD 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

setAllNodesUntyped

public void setAllNodesUntyped(boolean allUntyped)
Specify that all nodes encountered within this query or transformation will be untyped


areAllNodesUntyped

public boolean areAllNodesUntyped()
Determine whether all nodes encountered within this query or transformation are guaranteed to be untyped


getSchemaValidationMode

public int getSchemaValidationMode()
Determine whether source documents (supplied as a StreamSource or SAXSource) should be subjected to schema validation

Returns:
the schema validation mode previously set using setSchemaValidationMode(), or the default mode Validation.STRIP otherwise.

setSchemaValidationMode

public void setSchemaValidationMode(int validationMode)
Indicate whether source documents (supplied as a StreamSource or SAXSource) should be subjected to schema validation

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.

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.

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

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.

Normally all transformations and queries run under a single Java VM share the same NamePool. This creates a potential bottleneck, since changes to the namepool are synchronized. It is possible therefore to allocate a distinct NamePool to each Configuration. This requires considerable care and should only be done when the default arrangement is found to cause problems. There is a basic rule to follow: any compiled stylesheet or query must use the same NamePool as its source and result documents.

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

isStripsAllWhiteSpace

public boolean isStripsAllWhiteSpace()
Determine whether whitespace-only text nodes are to be stripped unconditionally from source documents.

Returns:
true if all whitespace-only text nodes are stripped.
Since:
8.4

setStripsAllWhiteSpace

public void setStripsAllWhiteSpace(boolean stripsAllWhiteSpace)
Determine whether whitespace-only text nodes are to be stripped unconditionally from source documents.

Parameters:
stripsAllWhiteSpace - if all whitespace-only text nodes are to be stripped.
Since:
8.4

getSourceParser

public org.xml.sax.XMLReader getSourceParser()
                                      throws javax.xml.transform.TransformerFactoryConfigurationError
Get a parser for source documents.

This method is intended primarily for internal use.

Throws:
javax.xml.transform.TransformerFactoryConfigurationError

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.

Throws:
javax.xml.transform.TransformerFactoryConfigurationError

readSchema

public java.lang.String readSchema(PipelineConfiguration pipe,
                                   java.lang.String baseURI,
                                   java.lang.String schemaLocation,
                                   java.lang.String expected)
                            throws javax.xml.transform.TransformerConfigurationException
Read a schema from a given schema location

Returns:
the target namespace of the schema

This method is intended for internal use.

Throws:
javax.xml.transform.TransformerConfigurationException

readMultipleSchemas

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

This method is intended for internal use.

Throws:
SchemaException

readInlineSchema

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

This method is intended for internal use.

Parameters:
pipe -
root - the xs:schema element in the stylesheet
expected - the target namespace expected; null if there is no expectation.
Returns:
the actual target namespace of the schema
Throws:
SchemaException

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.

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
Since:
8.4

addSchema

public void addSchema(java.lang.Object schema)
               throws javax.xml.transform.TransformerConfigurationException
Add a schema to the cache.

This method is intended for internal use

Parameters:
schema - an object of class javax.xml.validation.schema, which is not declared as such to avoid creating a dependency on this JDK 1.5 class
Throws:
javax.xml.transform.TransformerConfigurationException

getSchema

public java.lang.Object getSchema(java.lang.String namespace)
Get a schema from the cache. Return null if not found.

This method is intended for internal use.

Returns:
an object of class javax.xml.validation.schema, which is not declared as such to avoid creating a dependency on this JDK 1.5 class

getElementDeclaration

public SchemaDeclaration getElementDeclaration(int fingerprint)
Get a global element declaration.

This method is intended for internal use.

Returns:
the element declaration whose name matches the given fingerprint, or null if no element declaration with this name has been registered.

getAttributeDeclaration

public SchemaDeclaration getAttributeDeclaration(int fingerprint)
Get a global attribute declaration.

This method is intended for internal use

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(int fingerprint)
Get the top-level schema type definition with a given fingerprint.

This method is intended for internal use and for use by advanced applications. (The SchemaType object returned cannot yet be considered a stable API, and may be superseded when a JAXP API for schema information is defined.)

Parameters:
fingerprint - the fingerprint of the schema type
Returns:
the schema type , or null if there is none with this name.

getDocumentValidator

public Receiver getDocumentValidator(Receiver receiver,
                                     java.lang.String systemId,
                                     NamePool namePool,
                                     int validationMode)
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
namePool - the namePool to be used by the validator
validationMode - for example Validation.STRICT or Validation.STRIP. The integer may also have the bit Validation.VALIDATE_OUTPUT set, indicating that the strean being validated is to be treated as a final output stream (which means multiple errors can be reported)
Returns:
A Receiver to which events can be sent for validation

getElementValidator

public Receiver getElementValidator(Receiver receiver,
                                    int nameCode,
                                    int locationId,
                                    SchemaType schemaType,
                                    int validation,
                                    NamePool pool)
                             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
nameCode - the nameCode of the element to be validated. This must correspond to the name of an element declaration in a loaded schema
schemaType - the schema type (typically a complex type) against which the element is to be validated
validation - The validation mode, for example Validation.STRICT or Validation.LAX
pool - The name pool
Returns:
The target receiver, indicating that with this configuration, no validation is performed.
Throws:
XPathException

validateAttribute

public long validateAttribute(int nameCode,
                              java.lang.CharSequence value,
                              int validation)
                       throws ValidationException
Validate an attribute value.

This method is intended for internal use.

Parameters:
nameCode - the name of the attribute
value - the value of the attribute as a string
validation - STRICT or LAX
Returns:
the type annotation to apply to the attribute node
Throws:
ValidationException - if the value is invalid

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-B product, because type annotations can never arise.

This method is intended for internal use.


makeSubstitutionGroupTest

public NodeTest makeSubstitutionGroupTest(SchemaDeclaration elementDecl)
Make a test for elements corresponding to a give element declaration.

This method is intended for internal use.


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

getLocale

public static java.util.Locale getLocale(java.lang.String lang)
Get a locale given a language code in XML format.

This method is intended for internal use.


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.


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.


makeSlotManager

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

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


getOptimizer

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

This method is intended for internal use only.


setClassLoader

public void setClassLoader(java.lang.ClassLoader loader)
Set a ClassLoader to be used when loading external classes. Examples of classes that are loaded include SAX parsers, localization modules for formatting numbers and dates, extension functions, external object models. In an environment such as Eclipse that uses its own ClassLoader, this ClassLoader should be nominated to ensure that any class loaded by Saxon is identical to a class of the same name loaded by the external environment.

This method is intended for external use by advanced users, but should be regarded as experimental.


getClassLoader

public java.lang.ClassLoader getClassLoader()
Get the ClassLoader supplied using the method setClassLoader(java.lang.ClassLoader). If none has been supplied, return null.

This method is intended for external use by advanced users, but should be regarded as experimental.


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.

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. If this is null, then the classLoader used will be the first one available of: the classLoader registered with the Configuration using setClassLoader(java.lang.ClassLoader); the context class loader for the current thread; or failing that, the class loader invoked implicitly by a call of Class.forName() (which is the ClassLoader that was used to load the Configuration object itself).
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.

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. If this is null, then the classLoader used will be the first one available of: the classLoader registered with the Configuration using setClassLoader(java.lang.ClassLoader); the context class loader for the current thread; or failing that, the class loader invoked implicitly by a call of Class.forName() (which is the ClassLoader that was used to load the Configuration object itself).
Returns:
an instance of the class named, or null if it is not loadable.
Throws:
XPathException - if the class cannot be loaded.

makeCollator

public java.util.Comparator makeCollator(java.lang.String className)
                                  throws XPathException
Load a named collator class and check it is OK.

This method is intended for internal use only.

Throws:
XPathException

setLazyConstructionMode

public void setLazyConstructionMode(boolean lazy)
Set lazy construction mode on or off. In lazy construction mode, element constructors are not evaluated until the content of the tree is required. Lazy construction mode is currently experimental and is therefore off by default.

Parameters:
lazy - true to switch lazy construction mode on, false to switch it off.

isLazyConstructionMode

public boolean isLazyConstructionMode()
Determine whether lazy construction mode is on or off. In lazy construction mode, element constructors are not evaluated until the content of the tree is required. Lazy construction mode is currently experimental and is therefore off by default.

Returns:
true if lazy construction mode is enabled

registerStandardObjectModels

public void registerStandardObjectModels()
Register the standard Saxon-supplied object models.

This method is intended for internal use only.


registerExternalObjectModel

public void registerExternalObjectModel(ExternalObjectModel model)
Register an external object model.

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


findExternalObjectModel

public ExternalObjectModel findExternalObjectModel(java.lang.Object node)
Find the external object model corresponding to a given node.

This method is intended for internal use only.

Parameters:
node - a Node as implemented in some external object model
Returns:
the first registered external object model that recognizes this node; or null if no-one will own up to it.

getExternalObjectModels

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

This method is intended for internal use only.


makePipelineConfiguration

public PipelineConfiguration makePipelineConfiguration()
Make a PipelineConfiguration from the properties of this Configuration

Since:
8.4

setImplicitTimezone

public void setImplicitTimezone(int minutes)
Set the implicit timezone, as a positive or negative offset from UTC in minutes. The range is -14hours to +14hours


getImplicitTimezone

public int getImplicitTimezone()
Get the implicit timezone, as a positive or negative offset from UTC in minutes. The range is -14hours to +14hours

Specified by:
getImplicitTimezone in interface ConversionContext
Returns:
the value set using setImplicitTimezone(int), or failing that the timezone from the system clock at the time the Configuration was created.