BEA Systems, Inc.

WebLogic Server 6.1 API Reference

weblogic.apache.xalan.processor
Class TransformerFactoryImpl

java.lang.Object
  |
  +--javax.xml.transform.TransformerFactory
        |
        +--javax.xml.transform.sax.SAXTransformerFactory
              |
              +--weblogic.apache.xalan.processor.TransformerFactoryImpl
Direct Known Subclasses:
CompilingStylesheetProcessor

public class TransformerFactoryImpl
extends javax.xml.transform.sax.SAXTransformerFactory

The TransformerFactoryImpl, which implements the TRaX TransformerFactory interface, processes XSLT stylesheets into a Templates object (a StylesheetRoot).

This class is based on an implementation from the Apache XML Project. In future releases the XML parser, XSLT processor, and associated classes will likely be updated to be based on a later version of the Apache implementations. Since Apache does not guarantee backwards compatibility between versions of their software, we cannot guarantee backwards compatibility of any of the classes contained in the weblogic.apache package or sub-packages.


Field Summary
static java.lang.String XSLT_PROPERTIES
          The Xalan properties file.
 
Fields inherited from class javax.xml.transform.sax.SAXTransformerFactory
FEATURE, FEATURE_XMLFILTER
 
Constructor Summary
TransformerFactoryImpl()
          Constructor TransformerFactoryImpl
 
Method Summary
 javax.xml.transform.Source getAssociatedStylesheet(javax.xml.transform.Source source, java.lang.String media, java.lang.String title, java.lang.String charset)
          Get InputSource specification(s) that are associated with the given document specified in the source param, via the xml-stylesheet processing instruction (see http://www.w3.org/TR/xml-stylesheet/), and that matches the given criteria.
 java.lang.Object getAttribute(java.lang.String name)
          Allows the user to retrieve specific attributes on the underlying implementation.
 javax.xml.transform.ErrorListener getErrorListener()
          Get the error listener in effect for the TransformerFactory.
 boolean getFeature(java.lang.String name)
          Look up the value of a feature.
 javax.xml.transform.URIResolver getURIResolver()
          Get the object that will be used to resolve URIs used in xsl:import, etc.
 javax.xml.transform.Templates newTemplates(javax.xml.transform.Source source)
          Process the source into a Templates object, which is likely a compiled representation of the source.
 javax.xml.transform.sax.TemplatesHandler newTemplatesHandler()
          Create a new Transformer object that performs a copy of the source to the result.
 javax.xml.transform.Transformer newTransformer()
          Create a new Transformer object that performs a copy of the source to the result.
 javax.xml.transform.Transformer newTransformer(javax.xml.transform.Source source)
          Process the source into a Transformer object.
 javax.xml.transform.sax.TransformerHandler newTransformerHandler()
          Get a TransformerHandler object that can process SAX ContentHandler events into a Result.
 javax.xml.transform.sax.TransformerHandler newTransformerHandler(javax.xml.transform.Source src)
          Get a TransformerHandler object that can process SAX ContentHandler events into a Result, based on the transformation instructions specified by the argument.
 javax.xml.transform.sax.TransformerHandler newTransformerHandler(javax.xml.transform.Templates templates)
          Get a TransformerHandler object that can process SAX ContentHandler events into a Result, based on the Templates argument.
 org.xml.sax.XMLFilter newXMLFilter(javax.xml.transform.Source src)
          Create an XMLFilter that uses the given source as the transformation instructions.
 org.xml.sax.XMLFilter newXMLFilter(javax.xml.transform.Templates templates)
          Create an XMLFilter that uses the given source as the transformation instructions.
 javax.xml.transform.Templates processFromNode(org.w3c.dom.Node node)
           
 void setAttribute(java.lang.String name, java.lang.Object value)
          Allows the user to set specific attributes on the underlying implementation.
 void setErrorListener(javax.xml.transform.ErrorListener listener)
          Set an error listener for the TransformerFactory.
 void setURIResolver(javax.xml.transform.URIResolver resolver)
          Set an object that will be used to resolve URIs used in xsl:import, etc.
 
Methods inherited from class javax.xml.transform.TransformerFactory
newInstance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

XSLT_PROPERTIES

public static java.lang.String XSLT_PROPERTIES
The Xalan properties file.
Constructor Detail

TransformerFactoryImpl

public TransformerFactoryImpl()
Constructor TransformerFactoryImpl
Method Detail

processFromNode

public javax.xml.transform.Templates processFromNode(org.w3c.dom.Node node)
                                              throws javax.xml.transform.TransformerConfigurationException

getAssociatedStylesheet

public javax.xml.transform.Source getAssociatedStylesheet(javax.xml.transform.Source source,
                                                          java.lang.String media,
                                                          java.lang.String title,
                                                          java.lang.String charset)
                                                   throws javax.xml.transform.TransformerConfigurationException
Get InputSource specification(s) that are associated with the given document specified in the source param, via the xml-stylesheet processing instruction (see http://www.w3.org/TR/xml-stylesheet/), and that matches the given criteria. Note that it is possible to return several stylesheets that match the criteria, in which case they are applied as if they were a list of imports or cascades.

Note that DOM2 has it's own mechanism for discovering stylesheets. Therefore, there isn't a DOM version of this method.

Parameters:
source - The XML source that is to be searched.
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 capable of being used to create a Templates object.
Throws:
javax.xml.transform.TransformerConfigurationException -  
Overrides:
getAssociatedStylesheet in class javax.xml.transform.TransformerFactory

newTemplatesHandler

public javax.xml.transform.sax.TemplatesHandler newTemplatesHandler()
                                                             throws javax.xml.transform.TransformerConfigurationException
Create a new Transformer object that performs a copy of the source to the result.

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:
javax.xml.transform.TransformerConfigurationException - May throw this during the parse when it is constructing the Templates object and fails.
Overrides:
newTemplatesHandler in class javax.xml.transform.sax.SAXTransformerFactory

getFeature

public boolean getFeature(java.lang.String name)
Look up the value of a feature.

The feature name is any fully-qualified URI. It is possible for an TransformerFactory to recognize a feature name but to be unable to return its value; this is especially true in the case of an adapter for a SAX1 Parser, which has no way of knowing whether the underlying parser is validating, for example.

Parameters:
name - The feature name, which is a fully-qualified URI.
Returns:
The current state of the feature (true or false).
Overrides:
getFeature in class javax.xml.transform.TransformerFactory

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.Object value)
                  throws java.lang.IllegalArgumentException
Allows the user to set specific attributes on the underlying implementation.

Parameters:
name - The name of the attribute.
value - The value of the attribute.
Throws:
java.lang.IllegalArgumentException - thrown if the underlying implementation doesn't recognize the attribute.
Overrides:
setAttribute in class javax.xml.transform.TransformerFactory

getAttribute

public java.lang.Object getAttribute(java.lang.String name)
                              throws java.lang.IllegalArgumentException
Allows the user to retrieve specific attributes on the underlying implementation.

Parameters:
name - The name of the attribute.
Returns:
value The value of the attribute.
Throws:
java.lang.IllegalArgumentException - thrown if the underlying implementation doesn't recognize the attribute.
Overrides:
getAttribute in class javax.xml.transform.TransformerFactory

newXMLFilter

public org.xml.sax.XMLFilter newXMLFilter(javax.xml.transform.Source src)
                                   throws javax.xml.transform.TransformerConfigurationException
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:
javax.xml.transform.TransformerConfigurationException -  
Overrides:
newXMLFilter in class javax.xml.transform.sax.SAXTransformerFactory

newXMLFilter

public org.xml.sax.XMLFilter newXMLFilter(javax.xml.transform.Templates templates)
                                   throws javax.xml.transform.TransformerConfigurationException
Create an XMLFilter that uses the given source as the transformation instructions.

Parameters:
src - The source of the transformation instructions.
templates - non-null reference to Templates object.
Returns:
An XMLFilter object, or null if this feature is not supported.
Throws:
javax.xml.transform.TransformerConfigurationException -  
Overrides:
newXMLFilter in class javax.xml.transform.sax.SAXTransformerFactory

newTransformerHandler

public javax.xml.transform.sax.TransformerHandler newTransformerHandler(javax.xml.transform.Source src)
                                                                 throws javax.xml.transform.TransformerConfigurationException
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:
TransformerHandler ready to transform SAX events.
Throws:
javax.xml.transform.TransformerConfigurationException -  
Overrides:
newTransformerHandler in class javax.xml.transform.sax.SAXTransformerFactory

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.

Parameters:
templates - The source of the transformation instructions.
Returns:
TransformerHandler ready to transform SAX events.
Throws:
javax.xml.transform.TransformerConfigurationException -  
Overrides:
newTransformerHandler in class javax.xml.transform.sax.SAXTransformerFactory

newTransformerHandler

public javax.xml.transform.sax.TransformerHandler newTransformerHandler()
                                                                 throws javax.xml.transform.TransformerConfigurationException
Get a TransformerHandler object that can process SAX ContentHandler events into a Result.

Parameters:
src - The source of the transformation instructions.
Returns:
TransformerHandler ready to transform SAX events.
Throws:
javax.xml.transform.TransformerConfigurationException -  
Overrides:
newTransformerHandler in class javax.xml.transform.sax.SAXTransformerFactory

newTransformer

public javax.xml.transform.Transformer newTransformer(javax.xml.transform.Source source)
                                               throws javax.xml.transform.TransformerConfigurationException
Process the source into a Transformer object. Care must be given to know that this object can not be used concurrently in multiple threads.

Parameters:
source - An object that holds a URL, input stream, etc.
Returns:
A Transformer object capable of being used for transformation purposes in a single thread.
Throws:
javax.xml.transform.TransformerConfigurationException - May throw this during the parse when it is constructing the Templates object and fails.
Overrides:
newTransformer in class javax.xml.transform.TransformerFactory

newTransformer

public javax.xml.transform.Transformer newTransformer()
                                               throws javax.xml.transform.TransformerConfigurationException
Create a new Transformer object that performs a copy of the source to the result.

Parameters:
source - An object that holds a URL, input stream, etc.
Returns:
A Transformer object capable of being used for transformation purposes in a single thread.
Throws:
javax.xml.transform.TransformerConfigurationException - May throw this during the parse when it is constructing the Templates object and it fails.
Overrides:
newTransformer in class javax.xml.transform.TransformerFactory

newTemplates

public javax.xml.transform.Templates newTemplates(javax.xml.transform.Source source)
                                           throws javax.xml.transform.TransformerConfigurationException
Process the source into a Templates object, which is likely 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.

Parameters:
source - An object that holds a URL, input stream, etc.
Returns:
A Templates object capable of being used for transformation purposes.
Throws:
javax.xml.transform.TransformerConfigurationException - May throw this during the parse when it is constructing the Templates object and fails.
Overrides:
newTemplates in class javax.xml.transform.TransformerFactory

setURIResolver

public void setURIResolver(javax.xml.transform.URIResolver resolver)
Set an object that will be used to resolve URIs used in xsl:import, etc. This will be used as the default for the transformation.

Parameters:
resolver - An object that implements the URIResolver interface, or null.
Overrides:
setURIResolver in class javax.xml.transform.TransformerFactory

getURIResolver

public javax.xml.transform.URIResolver getURIResolver()
Get the object that will be used to resolve URIs used in xsl:import, etc. This will be used as the default for the transformation.

Returns:
The URIResolver that was set with setURIResolver.
Overrides:
getURIResolver in class javax.xml.transform.TransformerFactory

getErrorListener

public javax.xml.transform.ErrorListener getErrorListener()
Get the error listener in effect for the TransformerFactory.

Returns:
A non-null reference to an error listener.
Overrides:
getErrorListener in class javax.xml.transform.TransformerFactory

setErrorListener

public void setErrorListener(javax.xml.transform.ErrorListener listener)
                      throws java.lang.IllegalArgumentException
Set an error listener for the TransformerFactory.

Parameters:
listener - Must be a non-null reference to an ErrorListener.
Throws:
java.lang.IllegalArgumentException - if the listener argument is null.
Overrides:
setErrorListener in class javax.xml.transform.TransformerFactory

Documentation is available at
http://download.oracle.com/docs/cd/E13222_01/wls/docs61

WebLogic classes and methods that do not appear in this reference are not public and are not supported.