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 Details

    • 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 Details

    • 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 name FeatureKeys.CONFIGURATION
      Overrides:
      setConfiguration in class SaxonTransformerFactory
      Parameters:
      config - the Saxon configuration
    • newTemplates

      public Templates newTemplates(Source source) 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 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:
      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 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:
      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 class SaxonTransformerFactory
      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.