Class 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 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

      • 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 class SaxonTransformerFactory
        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 class SaxonTransformerFactory
        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 class SaxonTransformerFactory
        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.