net.sf.saxon
Class Controller

java.lang.Object
  extended by javax.xml.transform.Transformer
      extended by net.sf.saxon.Controller

public class Controller
extends Transformer

The Controller is Saxon's implementation of the JAXP Transformer class, and represents an executing instance of a transformation or query. Multiple concurrent executions of the same transformation or query will use different Controller instances. This class is therefore not thread-safe.

The Controller is serially reusable, as required by JAXP: when one transformation or query is finished, it can be used to run another. However, there is no advantage in doing this rather than allocating a new Controller each time.

The Controller can also be used when running Java applications that use neither XSLT nor XQuery. A dummy Controller is created when running free-standing XPath expressions.

The Controller holds those parts of the dynamic context that do not vary during the course of a transformation or query, or that do not change once their value has been computed. This also includes those parts of the static context that are required at run-time.

Wherever possible XSLT applications should use the JAXP Transformer class directly, rather than relying on Saxon-specific methods in the Controller. However, some features are currently available only through this class. This applies especially to new features specific to XSLT 2.0, since the JAXP interface still supports only XSLT 1.0. Such methods may be superseded in the future by JAXP methods.

Many methods on the Controller are designed for internal use and should not be considered stable. From release 8.4 onwards, those methods that are considered sufficiently stable to constitute path of the Saxon public API are labelled with the JavaDoc tag "since": the value indicates the release at which the method was added to the public API.

Since:
8.4
Author:
Michael H. Kay

Constructor Summary
Controller(Configuration config)
          Create a Controller and initialise variables.
Controller(Configuration config, Executable executable)
          Create a Controller and initialise variables.
 
Method Summary
 void addTraceListener(TraceListener trace)
          Adds the specified trace listener to receive trace events from this instance.
 void addUnavailableOutputDestination(DocumentURI uri)
          Add a URI to the set of output destinations that cannot be written to, either because they have already been written to, or because they have been read
 void allocateGlobalVariables(int numberOfVariables)
          Allocate space in the bindery for global variables.
 SequenceOutputter allocateSequenceOutputter(int size)
          Allocate a SequenceOutputter for a new output destination.
 void checkImplicitResultTree()
          Check whether an XSLT implicit result tree can be written.
 boolean checkUniqueOutputDestination(DocumentURI uri)
          Check that an output destination has not been used before, optionally adding this URI to the set of URIs that have been used.
 void clearDocumentPool()
          Clear the document pool.
 void clearParameters()
          Reset the parameters to a null list.
 void defineGlobalParameters()
          Register the global parameters of the transformation or query.
 String getBaseOutputURI()
          Get the base output URI.
 Bindery getBindery()
          Get the current bindery.
 ClassLoader getClassLoader()
          Get the ClassLoader supplied using the method setClassLoader(java.lang.ClassLoader).
 CollectionURIResolver getCollectionURIResolver()
          Get the CollectionURIResolver used for resolving references to collections.
 Configuration getConfiguration()
          Get the Configuration associated with this Controller.
 Item getContextForGlobalVariables()
          Get the item used as the context for evaluating global variables.
 String getCookedBaseOutputURI()
          Get the base output URI after processing.
 DateTimeValue getCurrentDateTime()
          Get the current date and time for this query or transformation.
 String getDefaultCollection()
          Get the name of the default collection.
 DocumentPool getDocumentPool()
          Get the document pool.
 ErrorListener getErrorListener()
          Get the error listener.
 Executable getExecutable()
          Get the Executable object.
 int getImplicitTimezone()
          Get the implicit timezone for this query or transformation
 Item getInitialContextItem()
          Get the initial context item.
 Mode getInitialMode()
          Get the initial mode for the transformation
 String getInitialModeName()
          Get the name of the initial mode for the transformation
 String getInitialTemplate()
          Get the initial template
 KeyManager getKeyManager()
          Get the KeyManager.
 Receiver getMessageEmitter()
          Get the Receiver used for xsl:message output.
 TreeModel getModel()
          Get the tree model that will be used.
 NamePool getNamePool()
          Get the name pool in use.
 Properties getOutputProperties()
          Get the output properties for the transformation.
 String getOutputProperty(String name)
          Get the value of an output property.
 OutputURIResolver getOutputURIResolver()
          Get the output URI resolver.
 Object getParameter(String expandedName)
          Get a parameter to the transformation.
 PathMap getPathMapForDocumentProjection()
          Get the path map used for document projection, if any.
 Result getPrincipalResult()
          Get the principal result destination.
 int getRecoveryPolicy()
          Get the policy for handling recoverable errors
 int getRememberedNumber(NodeInfo node)
          Get the number of a node if it is the last remembered one.
 RuleManager getRuleManager()
          Get the Rule Manager.
 SchemaURIResolver getSchemaURIResolver()
          Get the SchemaURIResolver used for resolving references to schema documents.
 int getSchemaValidationMode()
          Ask whether source documents loaded using the doc(), document(), and collection() functions, or supplied as a StreamSource or SAXSource to the transform() or addParameter() method should be subjected to schema validation
 SpaceStrippingRule getSpaceStrippingRule()
           
 URIResolver getStandardURIResolver()
          Get the fallback URI resolver.
 Receiver getStreamingReceiver(Mode mode, Result result)
          Get a receiver to which the input to this transformation can be supplied as a stream of events, causing the transformation to be executed in streaming mode.
 PrintStream getTraceFunctionDestination()
          Get the destination for output from the fn:trace() function.
 TraceListener getTraceListener()
          Get the TraceListener.
 int getTreeModel()
          Deprecated. since 9.2: use getModel()
 UnparsedTextURIResolver getUnparsedTextURIResolver()
          Get the URI resolver for the unparsed-text() function.
 URIResolver getURIResolver()
          Get the URI resolver.
 Object getUserData(Object key, String name)
          Get user data associated with a key.
 boolean hasThereBeenAnExplicitResultDocument()
          Test whether an explicit result tree has been written using xsl:result-document
 boolean isStripSourceTree()
          Ask whether the transformation will perform whitespace stripping for supplied source trees as defined by the xsl:strip-space and xsl:preserve-space declarations in the stylesheet.
 boolean isTracing()
          Test whether instruction execution is being traced.
 boolean isUnusedOutputDestination(DocumentURI uri)
          Determine whether an output URI is available for use.
 Iterator iterateParameters()
          Get an iterator over the names of global parameters that have been defined
 Builder makeBuilder()
          Make a builder for the selected tree model.
 PipelineConfiguration makePipelineConfiguration()
          Make a PipelineConfiguration based on the properties of this Controller.
 Stripper makeStripper(Receiver next)
          Make a Stripper configured to implement the whitespace stripping rules.
 XPathContextMajor newXPathContext()
          Make an XPathContext object for expression evaluation.
 void pauseTracing(boolean pause)
          Pause or resume tracing.
 void preEvaluateGlobals(XPathContext context)
          Pre-evaluate global variables (when debugging/tracing).
 NodeInfo prepareInputTree(Source source)
          Prepare an input tree for processing.
 void recoverableError(XPathException err)
          Report a recoverable error.
 void registerDocument(DocumentInfo doc, DocumentURI uri)
          Add a document to the document pool, and check that it is suitable for use in this query or transformation.
 void removeTraceListener(TraceListener trace)
          Removes the specified trace listener so that the listener will no longer receive trace events.
 void removeUnavailableOutputDestination(DocumentURI uri)
          Remove a URI from the set of output destinations that cannot be written to or read from.
 void reportFatalError(XPathException err)
          Report a fatal error
 void reset()
          Reset this Transformer to its original configuration.
 void reuseSequenceOutputter(SequenceOutputter out)
          Accept a SequenceOutputter that is now available for reuse
 void setBaseOutputURI(String uri)
          Set the base output URI.
 void setClassLoader(ClassLoader loader)
          Set a ClassLoader to be used when loading external classes.
 void setCollectionURIResolver(CollectionURIResolver resolver)
          Set the CollectionURIResolver used for resolving collection URIs.
 void setCurrentDateTime(DateTimeValue dateTime)
          Set the current date and time for this query or transformation.
 void setDefaultCollection(String uri)
          Set the name of the default collection.
 void setErrorListener(ErrorListener listener)
          Set the error listener.
 void setExecutable(Executable exec)
          Associate this Controller with an Executable.
 void setInitialContextItem(Item item)
          Set the initial context item, when running XQuery.
 void setInitialMode(String expandedModeName)
          Set the initial mode for the transformation.
 void setInitialTemplate(String expandedName)
          Set the initial named template to be used as the entry point.
 void setMessageEmitter(Receiver receiver)
          Set the Receiver to be used for xsl:message output.
 void setModel(TreeModel model)
          Set the tree model to use.
 void setOutputProperties(Properties properties)
          Set the output properties for the transformation.
 void setOutputProperty(String name, String value)
          Set an output property for the transformation.
 void setOutputURIResolver(OutputURIResolver resolver)
          Set the URI resolver for secondary output documents.
 void setParameter(String expandedName, Object value)
          Set a parameter for the transformation.
 void setParameter(StructuredQName qName, ValueRepresentation value)
          Supply a parameter using Saxon-specific representations of the name and value
 void setPreparedStylesheet(PreparedStylesheet sheet)
          Associate this Controller with a compiled stylesheet.
 void setRecoveryPolicy(int policy)
          Set the policy for handling recoverable XSLT errors.
 void setRememberedNumber(NodeInfo node, int number)
          Set the last remembered node, for node numbering purposes.
 void setRuleManager(RuleManager r)
          Set the RuleManager, used to manage template rules for each mode.
 void setSchemaURIResolver(SchemaURIResolver resolver)
          Set the SchemaURIResolver used for resolving references to schema documents.
 void setSchemaValidationMode(int validationMode)
          Say whether source documents loaded using the doc(), document(), and collection() functions, or supplied as a StreamSource or SAXSource to the transform() or addParameter() method, should be subjected to schema validation.
 void setStripSourceTrees(boolean strip)
          Say whether the transformation should perform whitespace stripping as defined by the xsl:strip-space and xsl:preserve-space declarations in the stylesheet in the case where a source tree is supplied to the transformation as a tree (typically a DOMSource, or a Saxon NodeInfo).
 void setThereHasBeenAnExplicitResultDocument()
          Set that an explicit result tree has been written using xsl:result-document
 void setTraceFunctionDestination(PrintStream stream)
          Set the destination for output from the fn:trace() function.
 void setTraceListener(TraceListener listener)
          Set a TraceListener, replacing any existing TraceListener
 void setTreeModel(int model)
          Deprecated. since 9.2: use setModel(net.sf.saxon.om.TreeModel)
 void setUnparsedTextURIResolver(UnparsedTextURIResolver resolver)
          Set an UnparsedTextURIResolver to be used to resolve URIs passed to the XSLT unparsed-text() function.
 void setURIResolver(URIResolver resolver)
          Set an object that will be used to resolve URIs used in document(), etc.
 void setUseDocumentProjection(PathMap pathMap)
          Indicate whether document projection should be used, and supply the PathMap used to control it.
 void setUserData(Object key, String name, Object data)
          Set user data associated with a key.
 void transform(Source source, Result result)
          Perform a transformation from a Source document to a Result document.
 void transformDocument(NodeInfo startNode, Result result)
          Transform a source XML document supplied as a tree.
 void transformStream(Source source, Mode mode, Result result)
          Transform a source XML document supplied as a stream, in streaming mode.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Controller

public Controller(Configuration config)
Create a Controller and initialise variables. Note: XSLT applications should create the Controller by using the JAXP newTransformer() method, or in S9API by using XsltExecutable.load()

Parameters:
config - The Configuration used by this Controller

Controller

public Controller(Configuration config,
                  Executable executable)
Create a Controller and initialise variables.

Parameters:
config - The Configuration used by this Controller
executable - The executable used by this Controller
Method Detail

reset

public void reset()

Reset this Transformer to its original configuration.

Transformer is reset to the same state as when it was created with TransformerFactory.newTransformer(), TransformerFactory.newTransformer(javax.xml.transform.Source source) or Templates.newTransformer(). reset() is designed to allow the reuse of existing Transformers thus saving resources associated with the creation of new Transformers.

The above is from the JAXP specification. With Saxon, it's unlikely that reusing a Transformer will give any performance benefits over creating a new one. The one case where it might be beneficial is to reuse the document pool (the set of documents that have been loaded using the doc() or document() functions). Therefore, this method does not clear the document pool. If you want to clear the document pool, call the method clearDocumentPool() as well.

The reset Transformer is not guaranteed to have the same URIResolver or ErrorListener Objects, e.g. Object.equals(Object obj). It is guaranteed to have a functionally equal URIResolver and ErrorListener.

Overrides:
reset in class Transformer
Since:
1.5

getConfiguration

public Configuration getConfiguration()
Get the Configuration associated with this Controller. The Configuration holds settings that potentially apply globally to many different queries and transformations.

Returns:
the Configuration object
Since:
8.4

setInitialMode

public void setInitialMode(String expandedModeName)
Set the initial mode for the transformation.

XSLT 2.0 allows a transformation to be started in a mode other than the default mode. The transformation then starts by looking for the template rule in this mode that best matches the initial context node.

This method may eventually be superseded by a standard JAXP method.

Parameters:
expandedModeName - the name of the initial mode. The mode is supplied as an expanded QName, that is "localname" if there is no namespace, or "{uri}localname" otherwise. If the value is null or zero-length, the initial mode is reset to the unnamed default mode.
Since:
8.4

getInitialModeName

public String getInitialModeName()
Get the name of the initial mode for the transformation

Returns:
the name of the initial mode, as a name in Clark format; null indicates that the initial mode is the unnamed mode.

getInitialMode

public Mode getInitialMode()
Get the initial mode for the transformation

Returns:
the initial mode. This will be the default/unnamed mode if no specific mode has been requested

setOutputProperties

public void setOutputProperties(Properties properties)
Set the output properties for the transformation. These properties will override properties set in the templates with xsl:output.

As well as the properties defined in the JAXP OutputKeys class, Saxon defines an additional set of properties in SaxonOutputKeys. These fall into two categories: Constants representing serialization properties defined in XSLT 2.0 (which are not yet supported by JAXP), and constants supporting Saxon extensions to the set of serialization properties.

Specified by:
setOutputProperties in class Transformer
Parameters:
properties - the output properties to be used for the transformation. If the value is null, the properties are reset to be the properties of the Templates object (that is, for XSLT 2.0, the properties set in the unnamed xsl:output object).
Throws:
IllegalArgumentException - if any of the properties are invalid (other than properties in a user-defined namespace)
Since:
8.4
See Also:
SaxonOutputKeys

getOutputProperties

public Properties getOutputProperties()
Get the output properties for the transformation.

As well as the properties defined in the JAXP OutputKeys class, Saxon defines an additional set of properties in SaxonOutputKeys. These fall into two categories: Constants representing serialization properties defined in XSLT 2.0 (which are not yet supported by JAXP), and constants supporting Saxon extensions to the set of serialization properties.

Specified by:
getOutputProperties in class Transformer
Returns:
the output properties being used for the transformation, including properties defined in the stylesheet for the unnamed output format
Since:
8.4
See Also:
SaxonOutputKeys

setOutputProperty

public void setOutputProperty(String name,
                              String value)
Set an output property for the transformation.

As well as the properties defined in the JAXP OutputKeys class, Saxon defines an additional set of properties in SaxonOutputKeys. These fall into two categories: Constants representing serialization properties defined in XSLT 2.0 (which are not yet supported by JAXP), and constants supporting Saxon extensions to the set of serialization properties.

As an extension to the JAXP specification, supplying the value "" (a zero-length string) for any parameter has the effect of cancelling any value defined in the stylesheet or query; for example setting doctype-system or doctype-public to "" causes the serializer to be run with these properties taken as absent. This rule does not apply to parameters where "" is a meaningful value, for example cdata-section-elements.

Specified by:
setOutputProperty in class Transformer
Parameters:
name - the name of the property
value - the value of the property
Throws:
IllegalArgumentException - if the property is invalid (except for properties in a user-defined namespace)
Since:
8.4
See Also:
SaxonOutputKeys

getOutputProperty

public String getOutputProperty(String name)
Get the value of an output property.

As well as the properties defined in the JAXP OutputKeys class, Saxon defines an additional set of properties in SaxonOutputKeys. These fall into two categories: Constants representing serialization properties defined in XSLT 2.0 (which are not yet supported by JAXP), and constants supporting Saxon extensions to the set of serialization properties.

Specified by:
getOutputProperty in class Transformer
Parameters:
name - the name of the requested property
Returns:
the value of the requested property
Since:
8.4
See Also:
SaxonOutputKeys

setBaseOutputURI

public void setBaseOutputURI(String uri)
Set the base output URI.

This defaults to the system ID of the Result object for the principal output of the transformation if this is known; if it is not known, it defaults to the current directory.

The base output URI is used for resolving relative URIs in the href attribute of the xsl:result-document instruction.

Parameters:
uri - the base output URI
Since:
8.4

getBaseOutputURI

public String getBaseOutputURI()
Get the base output URI.

This returns the value set using the setBaseOutputURI(java.lang.String) method. If no value has been set explicitly, then the method returns null if called before the transformation, or the computed default base output URI if called after the transformation.

The base output URI is used for resolving relative URIs in the href attribute of the xsl:result-document instruction.

Returns:
the base output URI
Since:
8.4

getCookedBaseOutputURI

public String getCookedBaseOutputURI()
Get the base output URI after processing. The processing consists of (a) defaulting to the current user directory if no base URI is available and if the stylesheet is trusted, and (b) applying IRI-to-URI escaping

Returns:
the base output URI after processing.

getPrincipalResult

public Result getPrincipalResult()
Get the principal result destination.

This method is intended for internal use only. It is typically called by Saxon during the course of a transformation, to discover the result that was supplied in the transform() call.

Returns:
the Result object supplied as the principal result destination.

checkUniqueOutputDestination

public boolean checkUniqueOutputDestination(DocumentURI uri)
Check that an output destination has not been used before, optionally adding this URI to the set of URIs that have been used.

Parameters:
uri - the URI to be used as the output destination
Returns:
true if the URI is available for use; false if it has already been used.

This method is intended for internal use only.


addUnavailableOutputDestination

public void addUnavailableOutputDestination(DocumentURI uri)
Add a URI to the set of output destinations that cannot be written to, either because they have already been written to, or because they have been read

Parameters:
uri - A URI that is not available as an output destination

removeUnavailableOutputDestination

public void removeUnavailableOutputDestination(DocumentURI uri)
Remove a URI from the set of output destinations that cannot be written to or read from. Used to support saxon:discard-document()

Parameters:
uri - A URI that is being made available as an output destination

isUnusedOutputDestination

public boolean isUnusedOutputDestination(DocumentURI uri)
Determine whether an output URI is available for use. This method is intended for use by applications, via an extension function.

Parameters:
uri - A uri that the application is proposing to use in the href attribute of xsl:result-document: if this function returns false, then the xsl:result-document call will fail saying the URI has already been used.
Returns:
true if the URI is available for use. Note that this function is not "stable": it may return different results for the same URI at different points in the transformation.

checkImplicitResultTree

public void checkImplicitResultTree()
                             throws XPathException
Check whether an XSLT implicit result tree can be written. This is allowed only if no xsl:result-document has been written for the principal output URI

Throws:
XPathException

setThereHasBeenAnExplicitResultDocument

public void setThereHasBeenAnExplicitResultDocument()
Set that an explicit result tree has been written using xsl:result-document


hasThereBeenAnExplicitResultDocument

public boolean hasThereBeenAnExplicitResultDocument()
Test whether an explicit result tree has been written using xsl:result-document

Returns:
true if the transformation has evaluated an xsl:result-document instruction

allocateSequenceOutputter

public SequenceOutputter allocateSequenceOutputter(int size)
Allocate a SequenceOutputter for a new output destination. Reuse the existing one if it is available for reuse (this is designed to ensure that the TinyTree structure is also reused, creating a forest of trees all sharing the same data structure)

Parameters:
size - the estimated size of the output sequence
Returns:
SequenceOutputter the allocated SequenceOutputter

reuseSequenceOutputter

public void reuseSequenceOutputter(SequenceOutputter out)
Accept a SequenceOutputter that is now available for reuse

Parameters:
out - the SequenceOutputter that is available for reuse

setInitialTemplate

public void setInitialTemplate(String expandedName)
                        throws XPathException
Set the initial named template to be used as the entry point.

XSLT 2.0 allows a transformation to start by executing a named template, rather than by matching an initial context node in a source document. This method may eventually be superseded by a standard JAXP method once JAXP supports XSLT 2.0.

Note that any parameters supplied using setParameter(java.lang.String, java.lang.Object) are used as the values of global stylesheet parameters. There is no way to supply values for local parameters of the initial template.

Parameters:
expandedName - The expanded name of the template in {uri}local format, or null or a zero-length string to indicate that there should be no initial template.
Throws:
XPathException - if there is no named template with this name
Since:
8.4

getInitialTemplate

public String getInitialTemplate()
Get the initial template

Returns:
the name of the initial template, as an expanded name in Clark format if set, or null otherwise
Since:
8.7

makePipelineConfiguration

public PipelineConfiguration makePipelineConfiguration()
Make a PipelineConfiguration based on the properties of this Controller.

This interface is intended primarily for internal use, although it may be necessary for applications to call it directly if they construct pull or push pipelines

Returns:
a newly constructed PipelineConfiguration holding a reference to this Controller as well as other configuration information.

setMessageEmitter

public void setMessageEmitter(Receiver receiver)
Set the Receiver to be used for xsl:message output.

Recent versions of the JAXP interface specify that by default the output of xsl:message is sent to the registered ErrorListener. Saxon does not implement this convention. Instead, the output is sent to a default message emitter, which is a slightly customised implementation of the standard Saxon Emitter interface.

This interface can be used to change the way in which Saxon outputs xsl:message output.

It is not necessary to use this interface in order to change the destination to which messages are written: that can be achieved by obtaining the standard message emitter and calling its Emitter.setWriter(java.io.Writer) method.

Although any Receiver can be supplied as the destination for messages, applications may find it convenient to implement a subclass of SequenceWriter, in which only the abstract write() method is implemented. This will have the effect that the write() method is called to output each message as it is generated, with the Item that is passed to the write() method being the document node at the root of an XML document containing the contents of the message.

This method is intended for use by advanced applications. The Receiver interface itself is subject to change in new Saxon releases.

The supplied Receiver will have its open() method called once at the start of the transformation, and its close() method will be called once at the end of the transformation. Each individual call of an xsl:message instruction is wrapped by calls of startDocument() and endDocument(). If terminate="yes" is specified on the xsl:message call, the properties argument of the startDocument() call will be set to the value ReceiverOptions.TERMINATE.

Parameters:
receiver - The receiver to receive xsl:message output.
Since:
8.4; changed in 8.9 to supply a Receiver rather than an Emitter

getMessageEmitter

public Receiver getMessageEmitter()
Get the Receiver used for xsl:message output. This returns the emitter previously supplied to the setMessageEmitter(net.sf.saxon.event.Receiver) method, or the default message emitter otherwise.

Returns:
the Receiver being used for xsl:message output
Since:
8.4; changed in 8.9 to return a Receiver rather than an Emitter

setRecoveryPolicy

public void setRecoveryPolicy(int policy)
Set the policy for handling recoverable XSLT errors.

Since 9.3 this call has no effect unless the error listener in use is a StandardErrorListener or a subclass thereof. Calling this method then results in a call to the StandardErrorListener to set the recovery policy, and the action that is taken on calls of the various methods error(), fatalError(), and warning() is then the responsibility of the ErrorListener itself.

Since 9.2 the policy for handling the most common recoverable error, namely the ambiguous template match that arises when a node matches more than one match pattern, is a compile-time rather than run-time setting, and can be controlled using CompilerInfo.setRecoveryPolicy(int)

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

getRecoveryPolicy

public int getRecoveryPolicy()
Get the policy for handling recoverable errors

Returns:
the current policy. If none has been set with this Controller, the value registered with the Configuration is returned.
Since:
8.7.1

setErrorListener

public void setErrorListener(ErrorListener listener)
Set the error listener.

Specified by:
setErrorListener in class Transformer
Parameters:
listener - the ErrorListener to be used

getErrorListener

public ErrorListener getErrorListener()
Get the error listener.

Specified by:
getErrorListener in class Transformer
Returns:
the ErrorListener in use

recoverableError

public void recoverableError(XPathException err)
                      throws XPathException
Report a recoverable error. This is an XSLT concept: by default, such an error results in a warning message, and processing continues. In XQuery, however, there are no recoverable errors so a fatal error is reported.

This method is intended for internal use only.

Parameters:
err - An exception holding information about the error
Throws:
XPathException - if the error listener decides not to recover from the error

reportFatalError

public void reportFatalError(XPathException err)
Report a fatal error

Parameters:
err - the error to be reported

getExecutable

public Executable getExecutable()
Get the Executable object.

This method is intended for internal use only.

Returns:
the Executable (which represents the compiled stylesheet)

getDocumentPool

public DocumentPool getDocumentPool()
Get the document pool. This is used only for source documents, not for stylesheet modules.

This method is intended for internal use only.

Returns:
the source document pool

clearDocumentPool

public void clearDocumentPool()
Clear the document pool. This is sometimes useful when re-using the same Transformer for a sequence of transformations, but it isn't done automatically, because when the transformations use common look-up documents, the caching is beneficial.


setInitialContextItem

public void setInitialContextItem(Item item)
Set the initial context item, when running XQuery.

When a transformation is invoked using the transform(javax.xml.transform.Source, javax.xml.transform.Result) method, the initial context node is set automatically. This method is useful in XQuery, to define an initial context node for evaluating global variables, and also in XSLT 2.0, when the transformation is started by invoking a named template.

When an initial context item is set, it also becomes the context item used for evaluating global variables. The two context items can only be different when the transform(javax.xml.transform.Source, javax.xml.transform.Result) method is used to transform a document starting at a node other than the root.

In XQuery, the two context items are always the same; in XSLT, the context node for evaluating global variables is the root of the tree containing the initial context item.

Parameters:
item - The initial context item.
Since:
8.7

getBindery

public Bindery getBindery()
Get the current bindery.

This method is intended for internal use only.

Returns:
the Bindery (in which values of all variables are held)

getInitialContextItem

public Item getInitialContextItem()
Get the initial context item. This returns the item (often a document node) previously supplied to the setInitialContextItem(net.sf.saxon.om.Item) method, or the initial context node set implicitly using methods such as transform(javax.xml.transform.Source, javax.xml.transform.Result).

Returns:
the initial context item. Note that in XSLT this must be a node, but in XQuery it may also be an atomic value.
Since:
8.7

getContextForGlobalVariables

public Item getContextForGlobalVariables()
Get the item used as the context for evaluating global variables. In XQuery this is the same as the initial context item; in XSLT it is the root of the tree containing the initial context node.

Returns:
the context item for evaluating global variables, or null if there is none
Since:
8.7

setURIResolver

public void setURIResolver(URIResolver resolver)
Set an object that will be used to resolve URIs used in document(), etc.

Specified by:
setURIResolver in class Transformer
Parameters:
resolver - An object that implements the URIResolver interface, or null.

getURIResolver

public URIResolver getURIResolver()
Get the URI resolver.

This method changed in Saxon 8.5, to conform to the JAXP specification. If there is no user-specified URIResolver, it now returns null; previously it returned the system default URIResolver.

Specified by:
getURIResolver in class Transformer
Returns:
the user-supplied URI resolver if there is one, or null otherwise.

getStandardURIResolver

public URIResolver getStandardURIResolver()
Get the fallback URI resolver. This is the URIResolver that Saxon uses when the user-supplied URI resolver returns null.

This method is intended for internal use only.

Returns:
the the system-defined URIResolver

setOutputURIResolver

public void setOutputURIResolver(OutputURIResolver resolver)
Set the URI resolver for secondary output documents.

XSLT 2.0 introduces the xsl:result-document This method may eventually be superseded by a standard JAXP method.

Parameters:
resolver - An object that implements the OutputURIResolver interface, or null.
Since:
8.4

getOutputURIResolver

public OutputURIResolver getOutputURIResolver()
Get the output URI resolver.

Returns:
the user-supplied URI resolver if there is one, or the system-defined one otherwise.
Since:
8.4
See Also:
setOutputURIResolver(net.sf.saxon.lib.OutputURIResolver)

setUnparsedTextURIResolver

public void setUnparsedTextURIResolver(UnparsedTextURIResolver resolver)
Set an UnparsedTextURIResolver to be used to resolve URIs passed to the XSLT unparsed-text() function.

Parameters:
resolver - the unparsed text URI resolver to be used. This replaces any unparsed text URI resolver previously registered.
Since:
8.9

getUnparsedTextURIResolver

public UnparsedTextURIResolver getUnparsedTextURIResolver()
Get the URI resolver for the unparsed-text() function. This will return the UnparsedTextURIResolver previously set using the setUnparsedTextURIResolver(net.sf.saxon.lib.UnparsedTextURIResolver) method.

Returns:
the registered UnparsedTextURIResolver
Since:
8.9

setSchemaURIResolver

public void setSchemaURIResolver(SchemaURIResolver resolver)
Set the SchemaURIResolver used for resolving references to schema documents. Defaults to the SchemaURIResolver registered with the Configuration

Parameters:
resolver - the resolver for references to schema documents

getSchemaURIResolver

public SchemaURIResolver getSchemaURIResolver()
Get the SchemaURIResolver used for resolving references to schema documents. If none has been set on the Controller, returns the SchemaURIResolver registered with the Configuration

Returns:
the resolver for references to schema documents

setCollectionURIResolver

public void setCollectionURIResolver(CollectionURIResolver resolver)
Set the CollectionURIResolver used for resolving collection URIs. Defaults to the CollectionURIResolver registered with the Configuration

Parameters:
resolver - the resolver for references to collections
Since:
9.4

getCollectionURIResolver

public CollectionURIResolver getCollectionURIResolver()
Get the CollectionURIResolver used for resolving references to collections. If none has been set on the Controller, returns the CollectionURIResolver registered with the Configuration

Returns:
the resolver for references to collections
Since:
9.4

setDefaultCollection

public void setDefaultCollection(String uri)
Set the name of the default collection. Defaults to the default collection name registered with the Configuration.

Parameters:
uri - the collection URI of the default collection. May be null, to cause fallback to the collection name registered with the Configuration. The name will be passed to the collection URI resolver to identify the documents in the collection, unless the name is http://saxon.sf.net/collection/empty which always refers to the empty collection.
Since:
9.4

getDefaultCollection

public String getDefaultCollection()
Get the name of the default collection. Defaults to the default collection name registered with the Configuration.

Returns:
the collection URI of the default collection. If no value has been set explicitly, the collection URI registered with the Configuration is returned
Since:
9.4

getSchemaValidationMode

public int getSchemaValidationMode()
Ask whether source documents loaded using the doc(), document(), and collection() functions, or supplied as a StreamSource or SAXSource to the transform() or addParameter() method 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)
Say whether source documents loaded using the doc(), document(), and collection() functions, or supplied as a StreamSource or SAXSource to the transform() or addParameter() method, should be subjected to schema validation. The default value is taken from the corresponding property of the Configuration.

Parameters:
validationMode - the validation (or construction) mode to be used for source documents. One of Validation.STRIP, Validation.PRESERVE, Validation.STRICT, Validation.LAX
Since:
9.2

getKeyManager

public KeyManager getKeyManager()
Get the KeyManager.

This method is intended for internal use only.

Returns:
the KeyManager, which holds details of all key declarations

getNamePool

public NamePool getNamePool()
Get the name pool in use. The name pool is responsible for mapping QNames used in source documents and compiled stylesheets and queries into numeric codes. All source documents used by a given transformation or query must use the same name pool as the compiled stylesheet or query.

Returns:
the name pool in use
Since:
8.4

setTreeModel

public void setTreeModel(int model)
Deprecated. since 9.2: use setModel(net.sf.saxon.om.TreeModel)

Set the tree data model to use. This affects all source documents subsequently constructed using a Builder obtained from this Controller. This includes a document built from a StreamSource or SAXSource supplied as a parameter to the transform(javax.xml.transform.Source, javax.xml.transform.Result) method.

Parameters:
model - the required tree model: Builder.LINKED_TREE, Builder.TINY_TREE, or Builder.TINY_TREE_CONDENSED
Since:
8.4 (Condensed tinytree added in 9.2)
See Also:
Builder

getTreeModel

public int getTreeModel()
Deprecated. since 9.2: use getModel()

Get the tree data model to use. This affects all source documents subsequently constructed using a Builder obtained from this Controller. This includes a document built from a StreamSource or SAXSource supplied as a parameter to the transform(javax.xml.transform.Source, javax.xml.transform.Result) method.

Returns:
model the tree model: Builder.LINKED_TREE, Builder.TINY_TREE, or Builder.TINY_TREE_CONDENSED
Since:
9.1 (Condensed tinytree added in 9.2)
See Also:
Builder

setModel

public void setModel(TreeModel model)
Set the tree model to use. Default is the tiny tree

Parameters:
model - typically one of the constants TreeModel.TINY_TREE, TreeModel.TINY_TREE_CONDENSED, or TreeModel.LINKED_TREE. It is also possible to use a user-defined tree model.
Since:
9.2

getModel

public TreeModel getModel()
Get the tree model that will be used.

Returns:
typically one of the constants TreeModel.TINY_TREE, TreeModel.TINY_TREE_CONDENSED, or TreeModel.LINKED_TREE. It is also possible to use a user-defined tree model.
Since:
9.2

makeBuilder

public Builder makeBuilder()
Make a builder for the selected tree model.

Returns:
an instance of the Builder for the chosen tree model
Since:
8.4

setStripSourceTrees

public void setStripSourceTrees(boolean strip)
Say whether the transformation should perform whitespace stripping as defined by the xsl:strip-space and xsl:preserve-space declarations in the stylesheet in the case where a source tree is supplied to the transformation as a tree (typically a DOMSource, or a Saxon NodeInfo). The default is true. It is legitimate to suppress whitespace stripping if the client knows that all unnecessary whitespace has already been removed from the tree before it is processed. Note that this option applies to all source documents for which whitespace-stripping is normally applied, that is, both the principal source documents, and documents read using the doc(), document(), and collection() functions. It does not apply to source documents that are supplied in the form of a SAXSource or StreamSource, for which whitespace is stripped during the process of tree construction.

Generally, stripping whitespace speeds up the transformation if it is done while building the source tree, but slows it down if it is applied to a tree that has already been built. So if the same source tree is used as input to a number of transformations, it is better to strip the whitespace once at the time of tree construction, rather than doing it on-the-fly during each transformation.

Parameters:
strip - true if whitespace is to be stripped from supplied source trees as defined by xsl:strip-space; false to suppress whitespace stripping
Since:
9.3

isStripSourceTree

public boolean isStripSourceTree()
Ask whether the transformation will perform whitespace stripping for supplied source trees as defined by the xsl:strip-space and xsl:preserve-space declarations in the stylesheet.

Returns:
true unless whitespace stripping has been suppressed using setStripSourceTrees(boolean).
Since:
9.3

makeStripper

public Stripper makeStripper(Receiver next)
Make a Stripper configured to implement the whitespace stripping rules. In the case of XSLT the whitespace stripping rules are normally defined by xsl:strip-space and xsl:preserve-spaceConfiguration.setStripsAllWhiteSpace(boolean).

Parameters:
next - the Receiver to which the events filtered by this stripper are to be sent (often a Builder). May be null if the stripper is not being used for filtering into a Builder or other Receiver.
Returns:
the required Stripper. A Stripper may be used in two ways. It acts as a filter applied to an event stream, that can be used to remove the events representing whitespace text nodes before they reach a Builder. Alternatively, it can be used to define a view of an existing tree in which the whitespace text nodes are dynamically skipped while navigating the XPath axes.
Since:
8.4 - Generalized in 8.5 to accept any Receiver as an argument

getSpaceStrippingRule

public SpaceStrippingRule getSpaceStrippingRule()

registerDocument

public void registerDocument(DocumentInfo doc,
                             DocumentURI uri)
                      throws XPathException
Add a document to the document pool, and check that it is suitable for use in this query or transformation. This check rejects the document if document has been validated (and thus carries type annotations) but the query or transformation is not schema-aware.

This method is intended for internal use only.

Parameters:
doc - the root node of the document to be added. Must not be null.
uri - the document-URI property of this document. If non-null, the document is registered in the document pool with this as its document URI.
Throws:
XPathException

setRuleManager

public void setRuleManager(RuleManager r)
Set the RuleManager, used to manage template rules for each mode.

This method is intended for internal use only.

Parameters:
r - the Rule Manager

getRuleManager

public RuleManager getRuleManager()
Get the Rule Manager.

This method is intended for internal use only.

Returns:
the Rule Manager, used to hold details of template rules for all modes

setTraceListener

public void setTraceListener(TraceListener listener)
Set a TraceListener, replacing any existing TraceListener

This method has no effect unless the stylesheet or query was compiled with tracing enabled.

Parameters:
listener - the TraceListener to be set. May be null, in which case trace events will not be reported
Since:
9.2

getTraceListener

public TraceListener getTraceListener()
Get the TraceListener. By default, there is no TraceListener, and this method returns null. A TraceListener may be added using the method addTraceListener(net.sf.saxon.lib.TraceListener). If more than one TraceListener has been added, this method will return a composite TraceListener. Because the form this takes is implementation-dependent, this method is not part of the stable Saxon public API.

Returns:
the TraceListener used for XSLT or XQuery instruction tracing, or null if absent.

isTracing

public final boolean isTracing()
Test whether instruction execution is being traced. This will be true if (a) at least one TraceListener has been registered using the addTraceListener(net.sf.saxon.lib.TraceListener) method, and (b) tracing has not been temporarily paused using the pauseTracing(boolean) method.

Returns:
true if tracing is active, false otherwise
Since:
8.4

pauseTracing

public final void pauseTracing(boolean pause)
Pause or resume tracing. While tracing is paused, trace events are not sent to any of the registered TraceListeners.

Parameters:
pause - true if tracing is to pause; false if it is to resume
Since:
8.4

addTraceListener

public void addTraceListener(TraceListener trace)
Adds the specified trace listener to receive trace events from this instance. Note that although TraceListeners can be added or removed dynamically, this has no effect unless the stylesheet or query has been compiled with tracing enabled. This is achieved by calling Configuration.setTraceListener(net.sf.saxon.lib.TraceListener) or by setting the attribute FeatureKeys.TRACE_LISTENER on the TransformerFactory. Conversely, if this property has been set in the Configuration or TransformerFactory, the TraceListener will automatically be added to every Controller that uses that Configuration.

Parameters:
trace - the trace listener. If null is supplied, the call has no effect.
Since:
8.4

removeTraceListener

public void removeTraceListener(TraceListener trace)
Removes the specified trace listener so that the listener will no longer receive trace events.

Parameters:
trace - the trace listener.
Since:
8.4

setTraceFunctionDestination

public void setTraceFunctionDestination(PrintStream stream)
Set the destination for output from the fn:trace() function. By default, the destination is System.err. If a TraceListener is in use, this is ignored, and the trace() output is sent to the TraceListener.

Parameters:
stream - the PrintStream to which trace output will be sent. If set to null, trace output is suppressed entirely. It is the caller's responsibility to close the stream after use.
Since:
9.1

getTraceFunctionDestination

public PrintStream getTraceFunctionDestination()
Get the destination for output from the fn:trace() function.

Returns:
the PrintStream to which trace output will be sent. If no explicitly destination has been set, returns System.err. If the destination has been set to null to suppress trace output, returns null.
Since:
9.1

setPreparedStylesheet

public void setPreparedStylesheet(PreparedStylesheet sheet)
Associate this Controller with a compiled stylesheet.

This method is intended for internal use only.

Parameters:
sheet - the compiled stylesheet

setExecutable

public void setExecutable(Executable exec)
Associate this Controller with an Executable. This method is used by the XQuery processor. The Executable object is overkill in this case - the only thing it currently holds are copies of the collation table.

This method is intended for internal use only

Parameters:
exec - the Executable

defineGlobalParameters

public void defineGlobalParameters()
                            throws XPathException
Register the global parameters of the transformation or query. This should be called after a sequence of calls on setParameter(java.lang.String, java.lang.Object). It checks that all required parameters have been supplied, and places the values of the parameters in the Bindery to make them available for use during the query or transformation.

This method is intended for internal use only

Throws:
XPathException

allocateGlobalVariables

public void allocateGlobalVariables(int numberOfVariables)
Allocate space in the bindery for global variables.

For internal use only.

Parameters:
numberOfVariables - the number of global variables for which space is required

getUserData

public Object getUserData(Object key,
                          String name)
Get user data associated with a key. To retrieve user data, two objects are required: an arbitrary object that may be regarded as the container of the data (originally, and typically still, a node in a tree), and a name. The name serves to distingush data objects associated with the same node by different client applications.

This method is intended primarily for internal use, though it may also be used by advanced applications.

Parameters:
key - an object acting as a key for this user data value. This must be equal (in the sense of the equals() method) to the key supplied when the data value was registered using setUserData(java.lang.Object, java.lang.String, java.lang.Object).
name - the name of the required property
Returns:
the value of the required property

setUserData

public void setUserData(Object key,
                        String name,
                        Object data)
Set user data associated with a key. To store user data, two objects are required: an arbitrary object that may be regarded as the container of the data (originally, and typically still, a node in a tree), and a name. The name serves to distingush data objects associated with the same node by different client applications.

This method is intended primarily for internal use, though it may also be used by advanced applications.

Parameters:
key - an object acting as a key for this user data value. This can be any object, for example a node or a string. If data for the given object and name already exists, it is overwritten.
name - the name of the required property
data - the value of the required property. If null is supplied, any existing entry for the key is removed.

transform

public void transform(Source source,
                      Result result)
               throws TransformerException
Perform a transformation from a Source document to a Result document.

Specified by:
transform in class Transformer
Parameters:
source - The input for the source tree. May be null if and only if an initial template has been supplied.
result - The destination for the result tree.
Throws:
XPathException - if the transformation fails. As a special case, the method throws a TerminationException (a subclass of XPathException) if the transformation was terminated using xsl:message terminate="yes".
TransformerException

prepareInputTree

public NodeInfo prepareInputTree(Source source)
Prepare an input tree for processing. This is used when either the initial input, or a Source returned by the document() function, is a NodeInfo or a DOMSource. The preparation consists of wrapping a DOM document inside a wrapper that implements the NodeInfo interface, and/or adding a space-stripping wrapper if the stylesheet strips whitespace nodes, and/or adding a type-stripping wrapper if the stylesheet strips input type annotations.

This method is intended for internal use.

Parameters:
source - the input tree. Must be either a DOMSource or a NodeInfo
Returns:
the NodeInfo representing the input node, suitably wrapped.

transformDocument

public void transformDocument(NodeInfo startNode,
                              Result result)
                       throws TransformerException
Transform a source XML document supplied as a tree.

This method is intended for internal use. External applications should use the transform(javax.xml.transform.Source, javax.xml.transform.Result) method, which is part of the JAXP interface. Note that NodeInfo implements the JAXP Source interface, so it may be supplied directly to the transform() method.

Parameters:
startNode - A Node that identifies the source document to be transformed and the node where the transformation should start. May be null if the transformation is to start using an initial template.
result - The output destination
Throws:
XPathException - if any dynamic error occurs
TransformerException

transformStream

public void transformStream(Source source,
                            Mode mode,
                            Result result)
                     throws TransformerException
Transform a source XML document supplied as a stream, in streaming mode.

This method is intended for internal use. External applications should use the transform(javax.xml.transform.Source, javax.xml.transform.Result) method, which is part of the JAXP interface. Note that NodeInfo implements the JAXP Source interface, so it may be supplied directly to the transform() method.

Parameters:
source - the principal input document, supplied as a SAXSource, StreamSource, or Transmitter
mode - the initial mode, which must be a streaming mode
result - The output destination
Throws:
XPathException - if any dynamic error occurs
TransformerException

getStreamingReceiver

public Receiver getStreamingReceiver(Mode mode,
                                     Result result)
                              throws TransformerException
Get a receiver to which the input to this transformation can be supplied as a stream of events, causing the transformation to be executed in streaming mode.

This method is intended for internal use. External applications should use the transform(javax.xml.transform.Source, javax.xml.transform.Result) method, which is part of the JAXP interface. Note that NodeInfo implements the JAXP Source interface, so it may be supplied directly to the transform() method. SAXSource, StreamSource, or Transmitter

Parameters:
mode - the initial mode, which must be a streaming mode
result - The output destination
Returns:
a receiver to which events can be streamed
Throws:
XPathException - if any dynamic error occurs
TransformerException

preEvaluateGlobals

public void preEvaluateGlobals(XPathContext context)
                        throws XPathException
Pre-evaluate global variables (when debugging/tracing).

This method is intended for internal use.

Parameters:
context - the dynamic context for evaluating the global variables
Throws:
XPathException - if a dynamic error occurs while evaluating the global variables.

setParameter

public void setParameter(String expandedName,
                         Object value)
Set a parameter for the transformation.

The following table shows some of the classes that are supported by this method. (Others may also be supported, but continued support is not guaranteed.) Each entry in the table shows first the Java class of the supplied object, and then the type of the resulting XPath value.

Java ClassXPath 2.0 type
Stringxs:string
Booleanxs:boolean
Integerxs:integer
Longxs:integer
Doublexs:double
Floatxs:float
BigDecimalxs:decimal
BigIntegerxs:integer
Datexs:dateTime
Array or List of any of the abovesequence of the above
nullempty sequence

A node may be supplied as a NodeInfo object, a sequence of nodes as an array or List of NodeInfo objects.

In addition, any object that implements the Saxon Value interface may be supplied, and will be used without conversion.

A node belong to an external object model (such as DOM, JDOM, or XOM) may be supplied provided (a) that the external object model is registered with the Configuration, and (b) that the node is part of a document tree that has been registered in the document pool.

Specified by:
setParameter in class Transformer
Parameters:
expandedName - The name of the parameter in {uri}local format
value - The value object. This must follow the rules above. Other formats in addition to those listed above may be accepted.
Since:
8.4

setParameter

public void setParameter(StructuredQName qName,
                         ValueRepresentation value)
Supply a parameter using Saxon-specific representations of the name and value

Parameters:
qName - The structured representation of the parameter name
value - The value of the parameter, or null to remove a previously set value

clearParameters

public void clearParameters()
Reset the parameters to a null list.

Specified by:
clearParameters in class Transformer

getParameter

public Object getParameter(String expandedName)
Get a parameter to the transformation. This returns the value of a parameter that has been previously set using the setParameter(java.lang.String, java.lang.Object) method. The value is returned exactly as supplied, that is, before any conversion to an XPath value.

Specified by:
getParameter in class Transformer
Parameters:
expandedName - the name of the required parameter, in "{uri}local-name" format
Returns:
the value of the parameter, if it exists, or null otherwise

iterateParameters

public Iterator iterateParameters()
Get an iterator over the names of global parameters that have been defined

Returns:
an Iterator whose items are strings in the form of Clark names, that is {uri}local

setCurrentDateTime

public void setCurrentDateTime(DateTimeValue dateTime)
                        throws XPathException
Set the current date and time for this query or transformation. This method is provided primarily for testing purposes, to allow tests to be run with a fixed date and time. The supplied date/time must include a timezone, which is used as the implicit timezone.

Note that comparisons of date/time values currently use the implicit timezone taken from the system clock, not from the value supplied here.

Parameters:
dateTime - the date/time value to be used as the current date and time
Throws:
IllegalStateException - if a current date/time has already been established by calling getCurrentDateTime(), or by a previous call on setCurrentDateTime()
XPathException - if the supplied dateTime contains no timezone

getCurrentDateTime

public DateTimeValue getCurrentDateTime()
Get the current date and time for this query or transformation. All calls during one transformation return the same answer.

Returns:
Get the current date and time. This will deliver the same value for repeated calls within the same transformation

getImplicitTimezone

public int getImplicitTimezone()
Get the implicit timezone for this query or transformation

Returns:
the implicit timezone as an offset in minutes

newXPathContext

public XPathContextMajor newXPathContext()
Make an XPathContext object for expression evaluation.

This method is intended for internal use.

Returns:
the new XPathContext

setRememberedNumber

public void setRememberedNumber(NodeInfo node,
                                int number)
Set the last remembered node, for node numbering purposes.

This method is strictly for internal use only.

Parameters:
node - the node in question
number - the number of this node

getRememberedNumber

public int getRememberedNumber(NodeInfo node)
Get the number of a node if it is the last remembered one.

This method is strictly for internal use only.

Parameters:
node - the node for which remembered information is required
Returns:
the number of this node if known, else -1.

setUseDocumentProjection

public void setUseDocumentProjection(PathMap pathMap)
Indicate whether document projection should be used, and supply the PathMap used to control it. Note: this is available only under Saxon-EE.

Parameters:
pathMap - a path map to be used for projecting source documents

getPathMapForDocumentProjection

public PathMap getPathMapForDocumentProjection()
Get the path map used for document projection, if any.

Returns:
the path map to be used for document projection, if one has been supplied; otherwise null

setClassLoader

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 for application use, but is experimental and subject to change.

Parameters:
loader - the ClassLoader to be used.

getClassLoader

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

This method is for application use, but is experimental and subject to change.

Returns:
the ClassLoader in use.


Copyright (c) 2004-2011 Saxonica Limited. All rights reserved.