Package org.exolab.adaptx.jaxp.transform
Class TransformerFactoryImpl
java.lang.Object
javax.xml.transform.TransformerFactory
javax.xml.transform.sax.SAXTransformerFactory
org.exolab.adaptx.jaxp.transform.TransformerFactoryImpl
An implementation of JAXP 1.1 TransfomerFactory. Please
see the JAXP 1.1 documentation for more information on how
this class should be used.
- Version:
- $Revision: 3955 $ $Date: 2003-10-07 10:37:35 +0200 (Tue, 07 Oct 2003) $
- Author:
- Keith Visco
-
Field Summary
FieldsFields inherited from class javax.xml.transform.sax.SAXTransformerFactory
FEATURE, FEATURE_XMLFILTER
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetAssociatedStylesheet
(Source source, String media, String title, String charset) Returns the associated stylesheet with the given source document.getAttribute
(String name) Allows the user to retrieve specific attributes on the underlying implementation.Get the error event handler for the TransformerFactory.boolean
getFeature
(String name) Look up the value of a feature.Get the object that is used by default during the transformation to resolve URIs used in document(), xsl:import, or xsl:include.newTemplates
(Source source) Process the Source into a Templates object, which is a a compiled representation of the source.Get a TemplatesHandler object that can process SAX ContentHandler events into a Templates object.Create a new Transformer object that performs a copy of the source to the result.newTransformer
(Source source) Process the Source into a Transformer object.Get a TransformerHandler object that can process SAX ContentHandler events into a Result.newTransformerHandler
(Source source) Get a TransformerHandler object that can process SAX ContentHandler events into a Result, based on the transformation instructions specified by the argument.newTransformerHandler
(Templates templates) Get a TransformerHandler object that can process SAX ContentHandler events into a Result, based on the Templates argument.newXMLFilter
(Source source) Create an XMLFilter that uses the given Source as the transformation instructions.newXMLFilter
(Templates templates) Create an XMLFilter, based on the Templates argument..void
setAttribute
(String name, Object value) Allows the user to set specific attributes on the underlying implementation.void
setErrorListener
(ErrorListener listener) Set the error event listener for the TransformerFactory, which is used for the processing of transformation instructions, and not for the transformation itself.void
setFeature
(String name, boolean value) void
setURIResolver
(URIResolver resolver) Set an object that is used by default during the transformation to resolve URIs used in xsl:import, or xsl:include.Methods inherited from class javax.xml.transform.TransformerFactory
newDefaultInstance, newInstance, newInstance
-
Field Details
-
SUPPORTED_FEATURES
The list of supported features
-
-
Constructor Details
-
TransformerFactoryImpl
public TransformerFactoryImpl()Creates a new TransformerFactoryImpl
-
-
Method Details
-
getAssociatedStylesheet
public Source getAssociatedStylesheet(Source source, String media, String title, String charset) throws TransformerConfigurationException Returns the associated stylesheet with the given source document.Refer to the JAXP 1.1 TransformerFactory documentation for more information
Note: This method is not yet supported.
- Specified by:
getAssociatedStylesheet
in classTransformerFactory
- Throws:
TransformerConfigurationException
-
getAttribute
Allows the user to retrieve specific attributes on the underlying implementation.- Specified by:
getAttribute
in classTransformerFactory
- Parameters:
name
- The name of the attribute.- Returns:
- value The value of the attribute.
- Throws:
IllegalArgumentException
- thrown if the underlying implementation doesn't recognize the attribute.
-
getErrorListener
Get the error event handler for the TransformerFactory.- Specified by:
getErrorListener
in classTransformerFactory
- Returns:
- The current error handler, which should never be null.
-
getFeature
Look up the value of a feature.The feature name is any absolute URI.
- Specified by:
getFeature
in classTransformerFactory
- Parameters:
name
- The feature name, which is an absolute URI.- Returns:
- The current state of the feature (true or false).
-
getURIResolver
Get the object that is used by default during the transformation to resolve URIs used in document(), xsl:import, or xsl:include.- Specified by:
getURIResolver
in classTransformerFactory
- Returns:
- The URIResolver that was set with setURIResolver.
-
newTemplates
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.- Specified by:
newTemplates
in classTransformerFactory
- 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.
-
newTransformer
Process the Source into a Transformer object. Care must be given not to use this object in multiple threads running concurrently. Different TransformerFactories can be used concurrently by different threads.- Specified by:
newTransformer
in classTransformerFactory
- Parameters:
source
- An object that holds a URI, input stream, etc.- Returns:
- A Transformer object that may be used to perform a transformation in a single thread, never null.
- Throws:
TransformerConfigurationException
- May throw this during the parse when it is constructing the Templates object and fails.
-
newTransformer
Create a new Transformer object that performs a copy of the source to the result.- Specified by:
newTransformer
in classTransformerFactory
- Parameters:
source
- An object that holds a URI, input stream, etc.- Returns:
- A Transformer object that may be used to perform a transformation in a single thread, never null.
- Throws:
TransformerConfigurationException
- May throw this during the parse when it is constructing the Templates object and fails.
-
setAttribute
Allows the user to set specific attributes on the underlying implementation. An attribute in this context is defined to be an option that the implementation provides.- Specified by:
setAttribute
in classTransformerFactory
- Parameters:
name
- The name of the attribute.value
- The value of the attribute.- Throws:
IllegalArgumentException
- thrown if the underlying implementation doesn't recognize the attribute.
-
setErrorListener
Set the error event listener for the TransformerFactory, which is used for the processing of transformation instructions, and not for the transformation itself.- Specified by:
setErrorListener
in classTransformerFactory
- Parameters:
listener
- The new error listener.- Throws:
IllegalArgumentException
- if listener is null.
-
setURIResolver
Set an object that is used by default during the transformation to resolve URIs used in xsl:import, or xsl:include.- Specified by:
setURIResolver
in classTransformerFactory
- Parameters:
resolver
- An object that implements the URIResolver interface, or null.
-
newTransformerHandler
public TransformerHandler newTransformerHandler(Source source) throws TransformerConfigurationException Get a TransformerHandler object that can process SAX ContentHandler events into a Result, based on the transformation instructions specified by the argument.- Specified by:
newTransformerHandler
in classSAXTransformerFactory
- Parameters:
src
- The Source of the transformation instructions.- Returns:
- TransformerHandler ready to transform SAX events.
- Throws:
TransformerConfigurationException
- If for some reason the TransformerHandler can not be created.
-
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.- Specified by:
newTransformerHandler
in classSAXTransformerFactory
- 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.
-
newTransformerHandler
Get a TransformerHandler object that can process SAX ContentHandler events into a Result. The transformation is defined as an identity (or copy) transformation, for example to copy a series of SAX parse events into a DOM tree.- Specified by:
newTransformerHandler
in classSAXTransformerFactory
- Returns:
- A non-null reference to a TransformerHandler, that may be used as a ContentHandler for SAX parse events.
- Throws:
TransformerConfigurationException
- If for some reason the TransformerHandler cannot be created.
-
newTemplatesHandler
Get a TemplatesHandler object that can process SAX ContentHandler events into a Templates object.- Specified by:
newTemplatesHandler
in classSAXTransformerFactory
- Returns:
- A non-null reference to a TransformerHandler, that may be used as a ContentHandler for SAX parse events.
- Throws:
TransformerConfigurationException
- If for some reason the TemplatesHandler cannot be created.
-
newXMLFilter
Create an XMLFilter that uses the given Source as the transformation instructions.- Specified by:
newXMLFilter
in classSAXTransformerFactory
- Parameters:
src
- The Source of the transformation instructions.- Returns:
- An XMLFilter object, or null if this feature is not supported.
- Throws:
TransformerConfigurationException
- If for some reason the TemplatesHandler cannot be created.
-
newXMLFilter
Create an XMLFilter, based on the Templates argument..- Specified by:
newXMLFilter
in classSAXTransformerFactory
- Parameters:
templates
- The compiled transformation instructions.- Returns:
- An XMLFilter object, or null if this feature is not supported.
- Throws:
TransformerConfigurationException
- If for some reason the TemplatesHandler cannot be created.
-
setFeature
- Specified by:
setFeature
in classTransformerFactory
- Throws:
TransformerConfigurationException
-