Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
net.sf.saxon.Configuration
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-SA has a subclass of the Configuration
class which provides the additional
services needed for schema-aware processing. The com.saxonica.validate.SchemaAwareConfiguration
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.
Field Summary | |
static int |
|
static int |
|
static int |
|
static int |
|
static int |
|
static int |
|
static int |
|
static int |
|
static int |
|
static int |
|
protected ErrorListener | |
protected Optimizer | |
protected int | |
protected VendorFunctionLibrary |
Constructor Summary | |
|
Method Summary | |
void |
|
void |
|
boolean |
|
DocumentInfo |
|
void |
|
Configuration |
|
protected void | |
void |
|
ExternalObjectModel |
|
Receiver |
|
SchemaDeclaration |
|
Class |
|
ClassLoader |
|
CollationURIResolver |
|
CollectionURIResolver |
|
static Configuration |
|
Object |
|
XPathContext |
|
int |
|
Debugger |
|
DocumentNumberAllocator |
|
Receiver |
|
SchemaDeclaration |
|
SequenceReceiver |
|
ErrorListener |
|
FunctionLibrary |
|
ExtensionFunctionFactory |
|
List |
|
DocumentPool |
|
int |
|
Set |
|
Object |
|
static Locale |
|
String |
|
ModuleURIResolver |
|
NameChecker |
|
NamePool |
|
Optimizer |
|
OutputURIResolver |
|
static Platform |
|
String |
|
int |
|
SchemaType |
|
SchemaURIResolver |
|
int |
|
SerializerFactory |
|
XMLReader |
|
String |
|
SourceResolver |
|
ModuleURIResolver |
|
int |
|
XMLReader |
|
String |
|
StandardURIResolver |
|
TraceListener |
|
int |
|
TypeHierarchy |
|
URIResolver |
|
VendorFunctionLibrary |
|
int |
|
protected void |
|
boolean |
|
boolean |
|
boolean |
|
boolean |
|
boolean |
|
boolean |
|
boolean |
|
boolean |
|
boolean |
|
boolean |
|
boolean |
|
boolean |
|
boolean |
|
boolean |
|
boolean |
|
boolean |
|
boolean |
|
boolean |
|
void |
|
StringCollator |
|
static Configuration |
|
ProxyReceiver |
|
Receiver |
|
XMLReader |
|
PipelineConfiguration |
|
static Configuration |
|
SlotManager |
|
TraceListener |
|
URIResolver |
|
String |
|
void |
|
String |
|
void |
|
void |
|
Source |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
NodeInfo |
|
int |
|
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.
- Field Value:
- 2
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
- Field Value:
- 53
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.
- Field Value:
- 0
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.
- Field Value:
- 1
public static final int XML10
Constant indicating the XML Version 1.0
- Field Value:
- 10
public static final int XML11
Constant indicating the XML Version 1.1
- Field Value:
- 11
public static final int XML_SCHEMA
Constant indicating that the "host language" is XML Schema
- Field Value:
- 52
public static final int XPATH
Constant indicating that the host language is XPATH itself - that is, a free-standing XPath environment
- Field Value:
- 54
public static final int XQUERY
Constant indicating that the host language is XQuery
- Field Value:
- 51
public static final int XSLT
Constant indicating that the host language is XSLT
- Field Value:
- 50
protected ErrorListener listener
protected int recoveryPolicy
public Configuration()
Create a non-schema-aware configuration object with default settings for all options.
- Since:
- 8.4
public void addSchemaSource(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
- Since:
- 8.4
public void addSchemaSource(Source schemaSource, ErrorListener errorListener) throws SchemaException
Load a schema, which will be available for use by all subsequent operations using this SchemaAwareConfiguration.
- Parameters:
schemaSource
- the JAXP Source object identifying the schema document to be loadederrorListener
- 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
public boolean areAllNodesUntyped()
Determine whether all nodes encountered within this query or transformation are guaranteed to be untyped
- Returns:
- true if it is known that all nodes will be untyped
public DocumentInfo buildDocument(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.
- Parameters:
source
- the Source to be used. This may be anAugmentedSource
, allowing options to be specified for the way in which this document will be built. A new tree will be built, using either the Tiny Tree or the Linked Tree implementation, except under the following circumstances:The choice between a tiny tree and a linked tree is determined first be the properties of the AugmentedSource if that's what is supplied; otherwise by the properties of this Configuration.
- The supplied object is a DocumentInfo. In this case a new tree will be built only if validation or whitespace stripping has been requested in the Configuration; otherwise the DocumentInfo will be returned unchanged.
- The supplied object is an AugmentedSource wrapping a DocumentInfo. In this case a new tree will be built if wrap=no has been specified, if validation has been requested, or if whitespace stripping has been requested, either in the AugmentedSource or in the Configuration.
- The supplied object is a DOMSource. In this case a new tree will be built if validation or whitespace stripping has been requested in the Configuration, or if the DOM Node is not a Document Node; in other cases the Document node of the DOMSource will be wrapped in a Saxon
DocumentWrapper
, except in the case where the DOM Document node is aDocumentOverNodeInfo
, in which case the DocumentInfo that it wraps is returned.- The supplied object is an AugmentedSource wrapping a DOMSource. In this case a new tree will be built if wrap=no has been specified, if validation has been requested, or if whitespace stripping has been requested, either in the AugmentedSource or in the Configuration.
- Returns:
- the document node of the constructed or wrapped document
- 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:
- 8.9. Modified in 9.0 to avoid copying a supplied document where this is not necessary.
public void checkTypeDerivationIsOK(SchemaType derived, SchemaType base, int block) throws SchemaException, ValidationException
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 typebase
- the base type; the algorithm tests whether derivation from this type is permittedblock
- the derivations that are blocked by the relevant element declaration
- Throws:
SchemaException
- if the derivation is not allowed
public Configuration copy()
Copy an existing Configuration to create a new Configuration. This is a shallow copy. The new Configuration will share all the option settings of the old; it will also share the same NamePool, and the same DocumentNumberAllocator. If this configuration is schema-aware then the new one will also be schema-aware, and will share the same Schema manager and so on. (So any schema component loaded into one configuration will affect both). Note that creating a new SchemaAwareConfiguration using this method can be significantly cheaper than creating one from scratch, because it avoids the need to verify the Saxon-SA license key if this has already been done.
- Returns:
- a shallow copy of this Configuration
public void displayLicenseMessage()
Display a message about the license status
public ExternalObjectModel findExternalObjectModel(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.
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.
- Parameters:
destination
- the Receiver that events will be written to after whitespace stripping
- Returns:
- the Receiver to which events should be sent for stripping
public SchemaDeclaration getAttributeDeclaration(int fingerprint)
Get a global attribute declaration. This method is intended for internal use
- Parameters:
fingerprint
- the namepool fingerprint 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.
public Class getClass(String className, boolean tracing, 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"tracing
- true if diagnostic tracing is requiredclassLoader
- 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 usingsetClassLoader(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.
public ClassLoader getClassLoader()
Get the ClassLoader supplied using the methodsetClassLoader(ClassLoader)
. If none has been supplied, return null. This method is intended for external use by advanced users, but should be regarded as experimental.
- Returns:
- the ClassLoader used in this configuration
public CollationURIResolver getCollationURIResolver()
Get the collation URI resolver associated with this configuration. This will return the CollationURIResolver previously set using thesetCollationURIResolver(CollationURIResolver)
method; if this has not been called, it returns the system-defined collation URI resolver
- Returns:
- the registered CollationURIResolver
- Since:
- 8.5
public CollectionURIResolver getCollectionURIResolver()
Get the collection URI resolver associated with this configuration. This will return the CollectionURIResolver previously set using thesetCollectionURIResolver(CollectionURIResolver)
method; if this has not been called, it returns the system-defined collection URI resolver
- Returns:
- the registered CollationURIResolver
- Since:
- 8.5
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
public Object getConfigurationProperty(String name)
Get a property of the configuration
- Parameters:
name
- the name of the required property. See the classFeatureKeys
for constants representing the property names that can be requested.
- Returns:
- the value of the property
public XPathContext getConversionContext()
Get an XPathContext object with sufficient capability to perform comparisons and conversions
- Returns:
- a dynamic context for performing conversions
public int getDOMLevel()
Get the level of DOM interface to be used
- Returns:
- the DOM level. Always 2 or 3.
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
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 withsetDocumentNumberAllocator(DocumentNumberAllocator)
, however, it is possible to have two different Configurations that share a single DocumentNumberAllocator
- Returns:
- the current DocumentNumberAllocator
- Since:
- 9.0
public Receiver getDocumentValidator(Receiver receiver, String systemId, int validationMode, int stripSpace, SchemaType schemaType, int topLevelElementName)
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 validationsystemId
- the base URI of the document being validatedvalidationMode
- 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)stripSpace
- options for space strippingschemaType
- The type against which the outermost element of the document must be validated (null if there is no constraint)topLevelElementName
- the namepool name code of the required top-level element in the instance document, or -1 if there is no specific element required
- Returns:
- A Receiver to which events can be sent for validation
public SchemaDeclaration getElementDeclaration(int fingerprint)
Get a global element declaration. This method is intended for internal use.
- Parameters:
fingerprint
- the NamePool fingerprint of the name of the required element declaration
- Returns:
- the element declaration whose name matches the given fingerprint, or null if no element declaration with this name has been registered.
public SequenceReceiver getElementValidator(SequenceReceiver receiver, int nameCode, int locationId, SchemaType schemaType, int validation) 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 elementnameCode
- the nameCode of the element to be validated. This must correspond to the name of an element declaration in a loaded schemalocationId
- current location in the stylesheet or queryschemaType
- the schema type (typically a complex type) against which the element is to be validatedvalidation
- The validation mode, for example Validation.STRICT or Validation.LAX
- Returns:
- The target receiver, indicating that with this configuration, no validation is performed.
public 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
public FunctionLibrary getExtensionBinder(String scheme)
Get the FunctionLibrary used to bind calls on extension functions on the specified platform. This mechanism is for advanced users only, and the details are subject to change.
- Parameters:
scheme
- The URI scheme served by the extension binder. Currently this must be one of "java" or "clitype". On the Java platform, the only scheme currently supported is "java"; on the .NET platform, the "java" and "clitype" schemes coexist.
- Returns:
- the registered FunctionLibrary for extension functions if one has been registered; or the default FunctionLibrary for extension functions otherwise
public ExtensionFunctionFactory getExtensionFunctionFactory(String scheme)
Get an ExtensionFunctionFactory. This is used at compile time for generating the code that calls Java or .NET 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.
- Parameters:
scheme
- - the extension function scheme. This must be one of "java" or "clitype", corresponding to the scheme name in the namespace URI of the extension function call
- Returns:
- the factory object registered to generate calls on extension functions, if one has been registered; if not, the default factory used by Saxon. The result will always be a
JavaExtensionFunctionFactory
in the case of the Java platform, or anet.sf.saxon.dotnet.DotNetExtensionFunctionFactory
on the .NET platform
public List 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
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
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, useContainer.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
public Set 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
public Object getInstance(String className, 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 usingsetClassLoader(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.
public static Locale getLocale(String lang)
Get a locale given a language code in XML format. This method is intended for internal use.
- Parameters:
lang
- the language code
- Returns:
- the Java locale
public 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
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
public NameChecker getNameChecker()
Get a class that can be used to check names against the selected XML version
- Returns:
- a class that can be used for name checking
- Since:
- 8.6
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
public Optimizer getOptimizer()
Factory method to get an Optimizer. This method is intended for internal use only.
- Returns:
- the optimizer used in this configuration
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
public static Platform getPlatform()
Get the Platform to be used for platform-dependent methods
- Returns:
- the platform to be used
public 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
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
, orDO_NOT_RECOVER
.
- Since:
- 8.4
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.
public SchemaURIResolver getSchemaURIResolver()
Get the user-defined SchemaURIResolver for resolving URIs used in "import schema" declarations; if none has been explicitly set, returns null.
- Returns:
- the user-defined SchemaURIResolver for resolving URIs
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.
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
public XMLReader getSourceParser() throws 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.
public 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
public SourceResolver getSourceResolver()
Get the current SourceResolver. If none has been supplied, a system-defined SourceResolver is returned.
- Returns:
- the current SourceResolver
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
public int getStripsWhiteSpace()
Set which kinds of whitespace-only text node should be stripped.
- Returns:
- kind the kind of whitespace-only text node that should be stripped when building a source tree. One of
Whitespace.NONE
(none),Whitespace.ALL
(all), orWhitespace.IGNORABLE
(element-content whitespace as defined in a DTD or schema)
public XMLReader getStyleParser() throws 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
public 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
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
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
public int getTreeModel()
Get the Tree Model used by this Configuration. This is eitherBuilder.LINKED_TREE
orBuilder.TINY_TREE
. The default (confusingly) isBuilder.TINY_TREE
.
- Returns:
- the selected Tree Model
- Since:
- 8.4
public final TypeHierarchy getTypeHierarchy()
Get the TypeHierarchy: a cache holding type information
- Returns:
- the type hierarchy cache
public 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
public VendorFunctionLibrary getVendorFunctionLibrary()
Get the FunctionLibrary used to bind calls on Saxon-defined extension functions. This method is intended for internal use only.
- Returns:
- the FunctionLibrary used for extension functions in the Saxon library.
public int getXMLVersion()
Get the XML version to be used by default for validating characters and names
- Since:
- 8.6
protected void init()
public boolean isAllowExternalFunctions()
Determine whether calls to external Java functions are permitted.
- Returns:
- true if such calls are permitted.
- Since:
- 8.4
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
public boolean isCompileWithTracing()
Determine whether compile-time generation of trace code was requested
- Returns:
- true if compile-time generation of code was requested
- Since:
- 8.8
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
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
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
public boolean isMultiThreading()
Determine whether multithreading optimizations are allowed
- Returns:
- true if multithreading optimizations are allowed
public boolean isOptimizerTracing()
Test whether optimizer tracing is on or off
- Returns:
- true if optimizer tracing is switched on
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
public boolean isSchemaAvailable(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.
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
- Returns:
- true if the configuration is schema-aware
- Since:
- 8.4
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
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.
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
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
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
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
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
public void loadSchema(String absoluteURI) throws SchemaException
Simple interface to load a schema document
- Parameters:
absoluteURI
- the absolute URI of the location of the schema document
public StringCollator makeCollator(String className) throws XPathException
Load a named collator class and check it is OK. This method is intended for internal use only.
- Parameters:
className
- the name of the collator class
- Returns:
- a StringCollator to implement a collation
public static Configuration makeConfiguration(ClassLoader classLoader, String className)
Factory method to create a Configuration. The resulting configuration will be schema-aware if Saxon-SA is installed and if a license is available; otherwise it will be non-schema-aware. Note that the license might not permit all processing options.
- 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 schema aware configuration class. Defaults to "com.saxonica.validate.SchemaAwareConfiguration" 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, but despite the name of this method there is nothing that requires it to be schema-aware.
- Returns:
- a schema-aware configuration object if Saxon-SA can be loaded and a valid license is installed; otherwise, a non-schema-aware configuration object
- Since:
- 9.0
public ProxyReceiver makeDocumentProjector(PathMap.PathMapRoot map)
Create a document projector for a given path map. Document projection is available only in Saxon-SA, so the Saxon-B version of this method throws an exception
- Parameters:
map
- the path map used to control document projection
- Returns:
- a push filter that implements document projection
public Receiver makeEmitter(String clarkName, Controller controller) 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}localcontroller
- the Controller. Allows a local class loader to be used.
- Returns:
- a Receiver (despite the name, it is not required to be an Emitter)
public XMLReader makeParser(String className) throws 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.
public PipelineConfiguration makePipelineConfiguration()
Make a PipelineConfiguration from the properties of this Configuration
- Returns:
- a new PipelineConfiguration
- Since:
- 8.4
public static Configuration makeSchemaAwareConfiguration(ClassLoader classLoader, String className) throws RuntimeException
Static method to instantiate a schema-aware configuration. On the .NET platform, this method should not be called unless it is known that the assembly saxon9sa.dll has already been loaded. This can be achieved by an appropriate call on Assembly.Load(): for an example, see the C# Configuration.cs class in the Saxon.Api namespace. This method fails if Saxon-SA cannot be loaded, but it does not fail if there is no license available. In that case it returns a schema-aware configuration object, but any attempt to use schema-aware processing will fail.
- 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 schema aware configuration class. Defaults to "com.saxonica.validate.SchemaAwareConfiguration" 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, but despite the name of this method there is nothing that requires it to be schema-aware.
- Returns:
- the new SchemaAwareConfiguration
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)
public TraceListener makeTraceListener(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
public URIResolver makeURIResolver(String className) throws 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
public String readInlineSchema(NodeInfo root, String expected, ErrorListener errorListener) throws SchemaException
Read an inline schema from a stylesheet. This method is intended for internal use.
- Parameters:
root
- the xs:schema element in the stylesheetexpected
- the target namespace expected; null if there is no expectation.errorListener
- 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
public void readMultipleSchemas(PipelineConfiguration pipe, String baseURI, List schemaLocations, String expected) throws SchemaException
Read schemas from a list of schema locations. This method is intended for internal use.
- Parameters:
pipe
- the pipeline configurationbaseURI
- the base URI against which the schema locations are to be resolvedschemaLocations
- the relative URIs specified as schema locationsexpected
- the namespace URI which is expected as the target namespace of the loaded schema
public String readSchema(PipelineConfiguration pipe, String baseURI, String schemaLocation, String expected) throws SchemaException
Read a schema from a given schema location This method is intended for internal use.
- Parameters:
pipe
- the PipelineConfigurationbaseURI
- the base URI of the instruction requesting the reading of the schemaschemaLocation
- the location of the schema to be readexpected
- The expected targetNamespace of the schema being read.
- Returns:
- the target namespace of the schema; null if there is no expectation
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. This method is intended for advanced users only, and is subject to change.
public void reportFatalError(XPathException err)
Report a fatal error
- Parameters:
err
- the exception to be reported
public Source resolveSource(Source source, Configuration config) throws XPathException
Implement the SourceResolver interface
- Specified by:
- resolveSource in interface SourceResolver
public void reuseSourceParser(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.
public void reuseStyleParser(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.
public void sealNamespace(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
public void setAllNodesUntyped(boolean allUntyped)
Specify that all nodes encountered within this query or transformation will be untyped
- Parameters:
allUntyped
- true if all nodes will be untyped
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. Setting the value to false disallows all of the following:Note that this option does not disable use of the
- Calls to Java extension functions
- Use of the XSLT system-property() function to access Java system properties
- Use of a relative URI in the
xsl:result-document
instruction- Calls to XSLT extension instructions
doc()
function or similar functions to access the filestore of the machine where the transformation or query is running. That should be done using a user-suppliedURIResolver
- Parameters:
allowExternalFunctions
- true if external function calls are to be permitted.
- Since:
- 8.4
public void setClassLoader(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.
- Parameters:
loader
- the ClassLoader to be used in this configuration
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
public void setCollectionURIResolver(CollectionURIResolver resolver)
Set a CollectionURIResolver to be used to resolve collection URIs (that is, the URI supplied in a call to the collection() function). Collection URIs are always resolved at run-time, using the CollectionURIResolver in force at the time the collection() function is called.
- Parameters:
resolver
- the collection URI resolver to be used. This replaces any collection URI resolver previously registered.
- Since:
- 8.5
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
public void setConfigurationProperty(String name, 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
- Parameters:
name
- the URI identifying the property to be set. See the classFeatureKeys
for constants representing the property names that can be set.value
- the value of the property
public void setDOMLevel(int level)
Set the level of DOM interface to be used
- Parameters:
level
- the DOM level. Must be 2 or 3. By default Saxon assumes that DOM level 3 is available; this parameter can be set to the value 2 to indicate that Saxon should not use methods unless they are available in DOM level 2.
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.
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 withgetDocumentNumberAllocator()
, 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
public void setErrorListener(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
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
public void setExtensionBinder(String scheme, 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, namelyJavaExtensionLibrary
. 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 aFunctionLibraryList
that itself contains two FunctionLibrary objects: a JavaExtensionLibrary, and a user-written FunctionLibrary.
- Parameters:
scheme
- The URI scheme served by the extension binder. Currently this must be one of "java" or "clitype". On the Java platform, the only scheme currently supported is "java"; on the .NET platform, the "java" and "clitype" schemes coexist.binder
- The FunctionLibrary object used to locate implementations of extension functions, based on their name and arity
public void setExtensionFunctionFactory(String scheme, 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.
- Parameters:
scheme
- - the extension function scheme. This must be one of "java" or "clitype", corresponding to the scheme name in the namespace URI of the extension function callfactory
- The extension function factory. This must always be aJavaExtensionFunctionFactory
for the "java" scheme, or anet.sf.saxon.dotnet.DotNetExtensionFunctionFactory
for the "clitype" scheme
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
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.
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
public void setMessageEmitterClass(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
public void setModuleURIResolver(String className) throws 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
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
public void setMultiThreading(boolean multithreading)
Set whether multithreading optimizations are allowed
- Parameters:
multithreading
- true if multithreading optimizations area allowed
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
public void setOptimizerTracing(boolean trace)
Set optimizer tracing on or off
- Parameters:
trace
- set to true to switch optimizer tracing on, false to switch it off
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
public void setParameterizedURIResolver()
Set the URIResolver to a URI resolver that allows query parameters after the URI, and in the case of Saxon-SA, that inteprets the file extension .ptree
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 areRECOVER_SILENTLY
,RECOVER_WITH_WARNINGS
, orDO_NOT_RECOVER
.
- Since:
- 8.4
public void setRetainDTDAttributeTypes(boolean useTypes) throws 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
- Since:
- 8.4
public void setSchemaURIResolver(SchemaURIResolver resolver)
Set a user-defined SchemaURIResolver for resolving URIs used in "import schema" declarations.
- Parameters:
resolver
- the URI resolver used for import schema declarations
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 ofValidation.STRIP
,Validation.PRESERVE
,Validation.STRICT
,Validation.LAX
- Since:
- 8.4
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
public void setSourceParserClass(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.
public void setSourceResolver(SourceResolver resolver)
Supply a SourceResolver. This is used for handling unknown implementations of thejavax.xml.transform.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.
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
public void setStripsWhiteSpace(int kind)
Set which kinds of whitespace-only text node should be stripped.
- Parameters:
kind
- the kind of whitespace-only text node that should be stripped when building a source tree. One ofWhitespace.NONE
(none),Whitespace.ALL
(all), orWhitespace.IGNORABLE
(element-content whitespace as defined in a DTD or schema)
public void setStyleParserClass(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
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.
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
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, usesetCompileWithTracing(boolean)
to force stylesheets and queries to be compiled with trace code enabled, and useController.addTraceListener(TraceListener)
to supply a TraceListener at run time.
- Parameters:
traceListener
- The TraceListener to be used.
- Since:
- 8.4
public void setTreeModel(int treeModel)
Set the Tree Model used by this Configuration. This is eitherBuilder.LINKED_TREE
orBuilder.TINY_TREE
. The default (confusingly) isBuilder.TINY_TREE
.
- Parameters:
treeModel
- the selected Tree Model
- Since:
- 8.4
public void setURIResolver(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
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
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
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
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
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
public NodeInfo unravel(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.
public int validateAttribute(int nameCode, CharSequence value, int validation) throws ValidationException
Validate an attribute value. This method is intended for internal use.
- Parameters:
nameCode
- the name of the attributevalue
- the value of the attribute as a stringvalidation
- STRICT or LAX
- Returns:
- the type annotation to apply to the attribute node
- Throws:
ValidationException
- if the value is invalid