Package net.sf.saxon.jaxp
Class StreamingTransformerImpl
- java.lang.Object
-
- javax.xml.transform.Transformer
-
- net.sf.saxon.jaxp.IdentityTransformer
-
- net.sf.saxon.jaxp.AbstractTransformerImpl
-
- net.sf.saxon.jaxp.StreamingTransformerImpl
-
public class StreamingTransformerImpl extends AbstractTransformerImpl
Saxon implementation of the JAXP Transformer interface. This implementation of Transformer is used when the factory is acom.saxonica.config.StreamingTransformerFactory
, and the effect is that thetransform(Source, Result)
method accepts a StreamSource or SAXSource and processes it in streaming mode, assuming that the initial mode is labelled withstreamable="yes"
. The global context item in such a transformation will be absent, so referring to "." within a global variable is an error.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
StreamingTransformerImpl.StreamingTransformerHandler
-
Constructor Summary
Constructors Modifier Constructor Description protected
StreamingTransformerImpl(XsltExecutable e, Xslt30Transformer t)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clearParameters()
Clear all parameters set with setParameter.Controller
getUnderlyingController()
Get the internal Saxon Controller instance that implements this transformation.Xslt30Transformer
getUnderlyingXsltTransformer()
Get the underlying s9api implementation class wrapped by this JAXP TransformerTransformerHandler
newTransformerHandler()
Get a TransformerHandler that can be used to run the transformation by feeding in SAX eventsXMLFilter
newXMLFilter()
Create a JAXP XMLFilter which allows this transformation to be added to a SAX pipelineprotected void
setConvertedParameter(QName name, XdmValue value)
void
setErrorListener(ErrorListener listener)
Set the error event listener in effect for the transformation.void
setInitialMode(String name)
Supply an initial mode for a transformation.void
setURIResolver(URIResolver resolver)
Set an object that will be used to resolve URIs used in document().void
transform(Source xmlSource, Result outputTarget)
Transform the XMLSource
to aResult
.-
Methods inherited from class net.sf.saxon.jaxp.AbstractTransformerImpl
getParameter, getStylesheetOutputProperties, getUnderlyingXsltExecutable, makeDestination, setParameter
-
Methods inherited from class net.sf.saxon.jaxp.IdentityTransformer
getConfiguration, getErrorListener, getLocalOutputProperties, getOutputProperties, getOutputProperty, getURIResolver, reportFatalError, reset, setOutputProperties, setOutputProperty
-
-
-
-
Constructor Detail
-
StreamingTransformerImpl
protected StreamingTransformerImpl(XsltExecutable e, Xslt30Transformer t)
-
-
Method Detail
-
transform
public void transform(Source xmlSource, Result outputTarget) throws XPathException
Transform the XML
Source
to aResult
. Specific transformation behavior is determined by the settings of theTransformerFactory
in effect when theTransformer
was instantiated and any modifications made to theTransformer
instance.An empty
Source
is represented as an empty document as constructed byDocumentBuilder.newDocument()
. The result of transforming an emptySource
depends on the transformation behavior; it is not always an emptyResult
.- Overrides:
transform
in classIdentityTransformer
- Parameters:
xmlSource
- The XML input to transform.outputTarget
- TheResult
of transforming thexmlSource
.- Throws:
XPathException
- If an unrecoverable error occurs during the course of the transformation.
-
setConvertedParameter
protected void setConvertedParameter(QName name, XdmValue value)
- Specified by:
setConvertedParameter
in classAbstractTransformerImpl
-
clearParameters
public void clearParameters()
Clear all parameters set with setParameter.- Overrides:
clearParameters
in classAbstractTransformerImpl
-
setURIResolver
public void setURIResolver(URIResolver resolver)
Set an object that will be used to resolve URIs used in document().If the resolver argument is null, the URIResolver value will be cleared and the transformer will no longer have a resolver.
- Overrides:
setURIResolver
in classIdentityTransformer
- Parameters:
resolver
- An object that implements the URIResolver interface, or null.
-
setErrorListener
public void setErrorListener(ErrorListener listener) throws IllegalArgumentException
Set the error event listener in effect for the transformation.- Overrides:
setErrorListener
in classIdentityTransformer
- Parameters:
listener
- The new error listener.- Throws:
IllegalArgumentException
- if listener is null.
-
setInitialMode
public void setInitialMode(String name) throws IllegalArgumentException
Supply an initial mode for a transformation.This is a Saxon extension to the JAXP interface, needed for XSLT 2.0
- Parameters:
name
- the name of the initial mode, in Clark notation (either a local name, or "{uri}local")- Throws:
IllegalArgumentException
- if the argument is invalid, for example if the format of the name is incorrect or if there is no mode with this name
-
getUnderlyingXsltTransformer
public Xslt30Transformer getUnderlyingXsltTransformer()
Get the underlying s9api implementation class wrapped by this JAXP Transformer- Returns:
- the underlying s9api XsltTransformer
-
getUnderlyingController
public Controller getUnderlyingController()
Get the internal Saxon Controller instance that implements this transformation. Note that the Controller interface will not necessarily remain stable in future releases- Specified by:
getUnderlyingController
in classAbstractTransformerImpl
- Returns:
- the underlying Saxon Controller instance
-
newXMLFilter
public XMLFilter newXMLFilter()
Create a JAXP XMLFilter which allows this transformation to be added to a SAX pipeline- Specified by:
newXMLFilter
in classAbstractTransformerImpl
- Returns:
- the transformation in the form of an XMLFilter
-
newTransformerHandler
public TransformerHandler newTransformerHandler() throws XPathException
Get a TransformerHandler that can be used to run the transformation by feeding in SAX events- Throws:
XPathException
-
-