Package com.saxonica.config
Class StreamingTransformerFactory
- java.lang.Object
-
- javax.xml.transform.TransformerFactory
-
- javax.xml.transform.sax.SAXTransformerFactory
-
- net.sf.saxon.jaxp.SaxonTransformerFactory
-
- net.sf.saxon.TransformerFactoryImpl
-
- com.saxonica.config.ProfessionalTransformerFactory
-
- com.saxonica.config.EnterpriseTransformerFactory
-
- com.saxonica.config.StreamingTransformerFactory
-
- All Implemented Interfaces:
Configuration.ApiProvider
public class StreamingTransformerFactory extends EnterpriseTransformerFactory
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.
-
-
Constructor Summary
Constructors Constructor Description StreamingTransformerFactory()
Create a StreamingTransformerFactory.StreamingTransformerFactory(EnterpriseConfiguration config)
Construct a StreamingTransformerFactory using an existing Configuration.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description javax.xml.transform.Templates
newTemplates(javax.xml.transform.Source source)
Process the Source into a Templates object, which is a a compiled representation of the source.javax.xml.transform.Templates
newTemplates(javax.xml.transform.Source source, CompilerInfo info)
Process the Source into a Templates object, which is a a compiled representation of the source.javax.xml.transform.sax.TransformerHandler
newTransformerHandler(javax.xml.transform.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
-
-
-
-
Constructor Detail
-
StreamingTransformerFactory
public StreamingTransformerFactory()
Create a StreamingTransformerFactory. An EnterpriseConfiguration will be created automatically.
-
StreamingTransformerFactory
public StreamingTransformerFactory(EnterpriseConfiguration config)
Construct a StreamingTransformerFactory using an existing Configuration.- Parameters:
config
- the configuration to be used. This must be an EnterpriseConfiguration.
-
-
Method Detail
-
setConfiguration
public void setConfiguration(Configuration config)
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
public javax.xml.transform.Templates newTemplates(javax.xml.transform.Source source) throws javax.xml.transform.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.- Returns:
- A Templates object capable of being used for transformation purposes, never null.
- Throws:
javax.xml.transform.TransformerConfigurationException
- May throw this during the parse when it is constructing the Templates object and fails.
-
newTemplates
public javax.xml.transform.Templates newTemplates(javax.xml.transform.Source source, CompilerInfo info) throws javax.xml.transform.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:
javax.xml.transform.TransformerConfigurationException
- May throw this during the parse when it is constructing the Templates object and fails.
-
newTransformerHandler
public javax.xml.transform.sax.TransformerHandler newTransformerHandler(javax.xml.transform.Templates templates) throws javax.xml.transform.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:
javax.xml.transform.TransformerConfigurationException
- If for some reason the TransformerHandler can not be created.
-
-