## org.apache.xalan.xsltc.trax
Class TransformerFactoryImpl

    java.lang.Object
      |
      +--javax.xml.transform.TransformerFactory
            |
            +--javax.xml.transform.sax.SAXTransformerFactory
                  |
                  +--org.apache.xalan.xsltc.trax.TransformerFactoryImpl

public class TransformerFactoryImpl
extends SAXTransformerFactory
implements SourceLoader, ErrorListener

Implementation of a JAXP1.1 TransformerFactory for Translets.

Field Summary
`static java.lang.String` `AUTO_TRANSLET`
`static java.lang.String` `DEBUG`
`static java.lang.String` `DESTINATION_DIRECTORY`
`static java.lang.String` `ENABLE_INLINING`
`static java.lang.String` `GENERATE_TRANSLET`
`static java.lang.String` `INDENT_NUMBER`
`static java.lang.String` `JAR_NAME`
`static java.lang.String` `PACKAGE_NAME`
`static java.lang.String` `TRANSLET_NAME`
`static java.lang.String` `USE_CLASSPATH`

Fields inherited from class javax.xml.transform.sax.SAXTransformerFactory
`FEATURE, FEATURE_XMLFILTER`

Constructor Summary
`TransformerFactoryImpl()` javax.xml.transform.sax.TransformerFactory implementation.

Method Summary
`void` `error(TransformerException e)` Receive notification of a recoverable error.
`void` `fatalError(TransformerException e)` Receive notification of a non-recoverable error.
`Source` `getAssociatedStylesheet(Source source, java.lang.String media, java.lang.String title, java.lang.String charset)` javax.xml.transform.sax.TransformerFactory implementation.
`java.lang.Object` `getAttribute(java.lang.String name)` javax.xml.transform.sax.TransformerFactory implementation.
`ErrorListener` `getErrorListener()` javax.xml.transform.sax.TransformerFactory implementation.
`boolean` `getFeature(java.lang.String name)` javax.xml.transform.sax.TransformerFactory implementation.
`URIResolver` `getURIResolver()` javax.xml.transform.sax.TransformerFactory implementation.
`InputSource` `loadSource(java.lang.String href, java.lang.String context, XSLTC xsltc)` This method implements XSLTC's SourceLoader interface.
`Templates` `newTemplates(Source source)` javax.xml.transform.sax.TransformerFactory implementation.
`TemplatesHandler` `newTemplatesHandler()` javax.xml.transform.sax.SAXTransformerFactory implementation.
`Transformer` `newTransformer()` javax.xml.transform.sax.TransformerFactory implementation.
`Transformer` `newTransformer(Source source)` javax.xml.transform.sax.TransformerFactory implementation.
`TransformerHandler` `newTransformerHandler()` javax.xml.transform.sax.SAXTransformerFactory implementation.
`TransformerHandler` `newTransformerHandler(Source src)` javax.xml.transform.sax.SAXTransformerFactory implementation.
`TransformerHandler` `newTransformerHandler(Templates templates)` javax.xml.transform.sax.SAXTransformerFactory implementation.
`XMLFilter` `newXMLFilter(Source src)` javax.xml.transform.sax.SAXTransformerFactory implementation.
`XMLFilter` `newXMLFilter(Templates templates)` javax.xml.transform.sax.SAXTransformerFactory implementation.
`void` `setAttribute(java.lang.String name, java.lang.Object value)` javax.xml.transform.sax.TransformerFactory implementation.
`void` `setErrorListener(ErrorListener listener)` javax.xml.transform.sax.TransformerFactory implementation.
`void` `setFeature(java.lang.String name, boolean value)` Set a feature for this `TransformerFactory` and `Transformer`s or `Template`s created by this factory.
`void` `setURIResolver(URIResolver resolver)` javax.xml.transform.sax.TransformerFactory implementation.
`void` `warning(TransformerException e)` Receive notification of a warning.

Methods inherited from class javax.xml.transform.TransformerFactory
`newInstance`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### TRANSLET_NAME

    public static final java.lang.String TRANSLET_NAME

### DESTINATION_DIRECTORY

    public static final java.lang.String DESTINATION_DIRECTORY

### PACKAGE_NAME

    public static final java.lang.String PACKAGE_NAME

### JAR_NAME

    public static final java.lang.String JAR_NAME

### GENERATE_TRANSLET

    public static final java.lang.String GENERATE_TRANSLET

### AUTO_TRANSLET

    public static final java.lang.String AUTO_TRANSLET

### USE_CLASSPATH

    public static final java.lang.String USE_CLASSPATH

### DEBUG

    public static final java.lang.String DEBUG

### ENABLE_INLINING

    public static final java.lang.String ENABLE_INLINING

### INDENT_NUMBER

    public static final java.lang.String INDENT_NUMBER

Constructor Detail

### TransformerFactoryImpl

    public TransformerFactoryImpl()

  javax.xml.transform.sax.TransformerFactory implementation.

Method Detail

### setErrorListener

    public void setErrorListener(ErrorListener listener)
                          throws java.lang.IllegalArgumentException

  javax.xml.transform.sax.TransformerFactory implementation. Set the error event listener for the TransformerFactory, which is used for the processing of transformation instructions, and not for the transformation itself.
  Parameters:
    `listener` - The error listener to use with the TransformerFactory
  Throws:
    java.lang.IllegalArgumentException -
  Overrides:
    setErrorListener in class TransformerFactory

### getErrorListener

    public ErrorListener getErrorListener()

  javax.xml.transform.sax.TransformerFactory implementation. Get the error event handler for the TransformerFactory.
  Returns:
    The error listener used with the TransformerFactory
  Overrides:
    getErrorListener in class TransformerFactory

### getAttribute

    public java.lang.Object getAttribute(java.lang.String name)
                                  throws java.lang.IllegalArgumentException

  javax.xml.transform.sax.TransformerFactory implementation. Returns the value set for a TransformerFactory attribute
  Parameters:
    `name` - The attribute name
  Returns:
    An object representing the attribute value
  Throws:
    java.lang.IllegalArgumentException -
  Overrides:
    getAttribute in class TransformerFactory

### setAttribute

    public void setAttribute(java.lang.String name,
                             java.lang.Object value)
                      throws java.lang.IllegalArgumentException

  javax.xml.transform.sax.TransformerFactory implementation. Sets the value for a TransformerFactory attribute.
  Parameters:
    `name` - The attribute name
    `value` - An object representing the attribute value
  Throws:
    java.lang.IllegalArgumentException -
  Overrides:
    setAttribute in class TransformerFactory

### setFeature

    public void setFeature(java.lang.String name,
                           boolean value)
                    throws TransformerConfigurationException

  Set a feature for this `TransformerFactory` and `Transformer`s or `Template`s created by this factory.

  Feature names are fully qualified `java.net.URI`s. Implementations may define their own features. An `TransformerConfigurationException` is thrown if this `TransformerFactory` or the `Transformer`s or `Template`s it creates cannot support the feature. It is possible for an `TransformerFactory` to expose a feature value but be unable to change its state.

  See `TransformerFactory` for full documentation of specific features.

  Parameters:
    `name` - Feature name.
    `value` - Is feature state `true` or `false`.
  Throws:
    TransformerConfigurationException - if this `TransformerFactory` or the `Transformer`s or `Template`s it creates cannot support this feature.
    java.lang.NullPointerException - If the `name` parameter is null.
  Overrides:
    setFeature in class TransformerFactory

### getFeature

    public boolean getFeature(java.lang.String name)

  javax.xml.transform.sax.TransformerFactory implementation. Look up the value of a feature (to see if it is supported). This method must be updated as the various methods and features of this class are implemented.
  Parameters:
    `name` - The feature name
  Returns:
    'true' if feature is supported, 'false' if not
  Overrides:
    getFeature in class TransformerFactory

### getURIResolver

    public URIResolver getURIResolver()

  javax.xml.transform.sax.TransformerFactory implementation. Get the object that is used by default during the transformation to resolve URIs used in document(), xsl:import, or xsl:include.
  Returns:
    The URLResolver used for this TransformerFactory and all Templates and Transformer objects created using this factory
  Overrides:
    getURIResolver in class TransformerFactory

### setURIResolver

    public void setURIResolver(URIResolver resolver)

  javax.xml.transform.sax.TransformerFactory implementation. Set the object that is used by default during the transformation to resolve URIs used in document(), xsl:import, or xsl:include. Note that this does not affect Templates and Transformers that are already created with this factory.
  Parameters:
    `resolver` - The URLResolver used for this TransformerFactory and all Templates and Transformer objects created using this factory
  Overrides:
    setURIResolver in class TransformerFactory

### getAssociatedStylesheet

    public Source getAssociatedStylesheet(Source source,
                                          java.lang.String media,
                                          java.lang.String title,
                                          java.lang.String charset)
                                   throws TransformerConfigurationException

  javax.xml.transform.sax.TransformerFactory implementation. Get the stylesheet specification(s) associated via the xml-stylesheet processing instruction (see http://www.w3.org/TR/xml-stylesheet/) with the document document specified in the source parameter, and that match the given criteria.
  Parameters:
    `source` - The XML source document.
    `media` - The media attribute to be matched. May be null, in which case the prefered templates will be used (i.e. alternate = no).
    `title` - The value of the title attribute to match. May be null.
    `charset` - The value of the charset attribute to match. May be null.
  Returns:
    A Source object suitable for passing to the TransformerFactory.
  Throws:
    TransformerConfigurationException -
  Overrides:
    getAssociatedStylesheet in class TransformerFactory

### newTransformer

    public Transformer newTransformer()
                               throws TransformerConfigurationException

  javax.xml.transform.sax.TransformerFactory implementation. Create a Transformer object that copies the input document to the result.
  Returns:
    A Transformer object that simply copies the source to the result.
  Throws:
    TransformerConfigurationException -
  Overrides:
    newTransformer in class TransformerFactory

### newTransformer

    public Transformer newTransformer(Source source)
                               throws TransformerConfigurationException

  javax.xml.transform.sax.TransformerFactory implementation. Process the Source into a Templates object, which is a a compiled representation of the source. Note that this method should not be used with XSLTC, as the time-consuming compilation is done for each and every transformation.
  Returns:
    A Templates object that can be used to create Transformers.
  Throws:
    TransformerConfigurationException -
  Overrides:
    newTransformer in class TransformerFactory

### newTemplates

    public Templates newTemplates(Source source)
                           throws TransformerConfigurationException

  javax.xml.transform.sax.TransformerFactory implementation. Process the Source into a Templates object, which is a a compiled representation of the source.
  Parameters:
    `source` - The input stylesheet - DOMSource not supported!!!
  Returns:
    A Templates object that can be used to create Transformers.
  Throws:
    TransformerConfigurationException -
  Overrides:
    newTemplates in class TransformerFactory

### newTemplatesHandler

    public TemplatesHandler newTemplatesHandler()
                                         throws TransformerConfigurationException

  javax.xml.transform.sax.SAXTransformerFactory implementation. Get a TemplatesHandler object that can process SAX ContentHandler events into a Templates object.
  Returns:
    A TemplatesHandler object that can handle SAX events
  Throws:
    TransformerConfigurationException -
  Overrides:
    newTemplatesHandler in class SAXTransformerFactory

### newTransformerHandler

    public TransformerHandler newTransformerHandler()
                                             throws TransformerConfigurationException

  javax.xml.transform.sax.SAXTransformerFactory implementation. Get a TransformerHandler object that can process SAX ContentHandler events into a Result. This method will return a pure copy transformer.
  Returns:
    A TransformerHandler object that can handle SAX events
  Throws:
    TransformerConfigurationException -
  Overrides:
    newTransformerHandler in class SAXTransformerFactory

### newTransformerHandler

    public TransformerHandler newTransformerHandler(Source src)
                                             throws TransformerConfigurationException

  javax.xml.transform.sax.SAXTransformerFactory implementation. Get a TransformerHandler object that can process SAX ContentHandler events into a Result, based on the transformation instructions specified by the argument.
  Parameters:
    `src` - The source of the transformation instructions.
  Returns:
    A TransformerHandler object that can handle SAX events
  Throws:
    TransformerConfigurationException -
  Overrides:
    newTransformerHandler in class SAXTransformerFactory

### newTransformerHandler

    public TransformerHandler newTransformerHandler(Templates templates)
                                             throws TransformerConfigurationException

  javax.xml.transform.sax.SAXTransformerFactory implementation. Get a TransformerHandler object that can process SAX ContentHandler events into a Result, based on the transformation instructions specified by the argument.
  Parameters:
    `templates` - Represents a pre-processed stylesheet
  Returns:
    A TransformerHandler object that can handle SAX events
  Throws:
    TransformerConfigurationException -
  Overrides:
    newTransformerHandler in class SAXTransformerFactory

### newXMLFilter

    public XMLFilter newXMLFilter(Source src)
                           throws TransformerConfigurationException

  javax.xml.transform.sax.SAXTransformerFactory implementation. Create an XMLFilter that uses the given source as the transformation instructions.
  Parameters:
    `src` - The source of the transformation instructions.
  Returns:
    An XMLFilter object, or null if this feature is not supported.
  Throws:
    TransformerConfigurationException -
  Overrides:
    newXMLFilter in class SAXTransformerFactory

### newXMLFilter

    public XMLFilter newXMLFilter(Templates templates)
                           throws TransformerConfigurationException

  javax.xml.transform.sax.SAXTransformerFactory implementation. Create an XMLFilter that uses the given source as the transformation instructions.
  Parameters:
    `templates` - The source of the transformation instructions.
  Returns:
    An XMLFilter object, or null if this feature is not supported.
  Throws:
    TransformerConfigurationException -
  Overrides:
    newXMLFilter in class SAXTransformerFactory

### error

    public void error(TransformerException e)
               throws TransformerException

  Receive notification of a recoverable error. The transformer must continue to provide normal parsing events after invoking this method. It should still be possible for the application to process the document through to the end.
  Specified by:
    error in interface ErrorListener
  Parameters:
    `e` - The warning information encapsulated in a transformer exception.
  Throws:
    TransformerException - if the application chooses to discontinue the transformation (always does in our case).

### fatalError

    public void fatalError(TransformerException e)
                    throws TransformerException

  Receive notification of a non-recoverable error. The application must assume that the transformation cannot continue after the Transformer has invoked this method, and should continue (if at all) only to collect addition error messages. In fact, Transformers are free to stop reporting events once this method has been invoked.
  Specified by:
    fatalError in interface ErrorListener
  Parameters:
    `e` - warning information encapsulated in a transformer exception.
  Throws:
    TransformerException - if the application chooses to discontinue the transformation (always does in our case).

### warning

    public void warning(TransformerException e)
                 throws TransformerException

  Receive notification of a warning. Transformers can use this method to report conditions that are not errors or fatal errors. The default behaviour is to take no action. After invoking this method, the Transformer must continue with the transformation. It should still be possible for the application to process the document through to the end.
  Specified by:
    warning in interface ErrorListener
  Parameters:
    `e` - The warning information encapsulated in a transformer exception.
  Throws:
    TransformerException - if the application chooses to discontinue the transformation (never does in our case).

### loadSource

    public InputSource loadSource(java.lang.String href,
                                  java.lang.String context,
                                  XSLTC xsltc)

  This method implements XSLTC's SourceLoader interface. It is used to glue a TrAX URIResolver to the XSLTC compiler's Input and Import classes.
  Specified by:
    loadSource in interface SourceLoader
  Parameters:
    `href` - The URI of the document to load
    `context` - The URI of the currently loaded document
    `xsltc` - The compiler that resuests the document
  Returns:
    An InputSource with the loaded document

Copyright © 2006 Apache XML Project. All Rights Reserved.