Package com.saxonica.config
Class StreamingTransformerFactory
- All Implemented Interfaces:
Configuration.ApiProvider
The is a customized JAXP TransformerFactory implementation for the enterprise
edition of Saxon. It is designed specifically for running XSLT 3.0 streaming
transformations, where the Source object supplied to the Transformer.transform()
method is supplied as a SAXSource or StreamSource. Because it is designed for
streaming, the source document does not become the global context item (specifically,
if a global variable references the value of the context item ".", a dynamic error
XPDY0002 occurs). This means that this JAXP TransformerFactory is not a 100% compatible
replacement for a "standard" TransformerFactory.
-
Field Summary
Fields inherited from class javax.xml.transform.sax.SAXTransformerFactory
FEATURE, FEATURE_XMLFILTER
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a StreamingTransformerFactory.Construct a StreamingTransformerFactory using an existing Configuration. -
Method Summary
Modifier and TypeMethodDescriptionnewTemplates
(Source source) Process the Source into a Templates object, which is a a compiled representation of the source.newTemplates
(Source source, CompilerInfo info) Process the Source into a Templates object, which is a a compiled representation of the source.newTransformerHandler
(Templates templates) Get a TransformerHandler object that can process SAX ContentHandler events into a Result, based on the Templates argument.void
setConfiguration
(Configuration config) Set the configuration.Methods inherited from class com.saxonica.config.EnterpriseTransformerFactory
addSchema, setAttribute
Methods inherited from class net.sf.saxon.jaxp.SaxonTransformerFactory
getAssociatedStylesheet, getAttribute, getConfiguration, getErrorListener, getFeature, getProcessor, getURIResolver, newTemplatesHandler, newTransformer, newTransformer, newTransformerHandler, newTransformerHandler, newXMLFilter, newXMLFilter, setErrorListener, setFeature, setURIResolver
Methods inherited from class javax.xml.transform.TransformerFactory
newDefaultInstance, newInstance, newInstance
-
Constructor Details
-
StreamingTransformerFactory
public StreamingTransformerFactory()Create a StreamingTransformerFactory. An EnterpriseConfiguration will be created automatically. -
StreamingTransformerFactory
Construct a StreamingTransformerFactory using an existing Configuration.- Parameters:
config
- the configuration to be used. This must be an EnterpriseConfiguration.
-
-
Method Details
-
setConfiguration
Description copied from class:SaxonTransformerFactory
Set the configuration. This can also be done using the JAXP method setAttribute, with the attribute nameFeatureKeys.CONFIGURATION
- Overrides:
setConfiguration
in classSaxonTransformerFactory
- Parameters:
config
- the Saxon configuration
-
newTemplates
Description copied from class:SaxonTransformerFactory
Process the Source into a Templates object, which is a a compiled representation of the source. This Templates object may then be used concurrently across multiple threads. Creating a Templates object allows the TransformerFactory to do detailed performance optimization of transformation instructions, without penalizing runtime transformation.- Overrides:
newTemplates
in classSaxonTransformerFactory
- Parameters:
source
- An object that holds a URL, input stream, etc.- Returns:
- A Templates object capable of being used for transformation purposes, never null.
- Throws:
TransformerConfigurationException
- May throw this during the parse when it is constructing the Templates object and fails.
-
newTemplates
public Templates newTemplates(Source source, CompilerInfo info) throws TransformerConfigurationException Description copied from class:SaxonTransformerFactory
Process the Source into a Templates object, which is a a compiled representation of the source. This Templates object may then be used concurrently across multiple threads. Creating a Templates object allows the TransformerFactory to do detailed performance optimization of transformation instructions, without penalizing runtime transformation.- Overrides:
newTemplates
in classSaxonTransformerFactory
- Parameters:
source
- An object that holds a URL, input stream, etc.info
- compile-time options for this stylesheet compilation- Returns:
- A Templates object capable of being used for transformation purposes, never null.
- Throws:
TransformerConfigurationException
- May throw this during the parse when it is constructing the Templates object and fails.
-
newTransformerHandler
public TransformerHandler newTransformerHandler(Templates templates) throws TransformerConfigurationException Get a TransformerHandler object that can process SAX ContentHandler events into a Result, based on the Templates argument.- Overrides:
newTransformerHandler
in classSaxonTransformerFactory
- Parameters:
templates
- The compiled transformation instructions.- Returns:
- TransformerHandler ready to transform SAX events.
- Throws:
TransformerConfigurationException
- If for some reason the TransformerHandler can not be created.
-