|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.xml.transform.Transformer org.apache.xalan.xsltc.trax.TransformerImpl
public final class TransformerImpl
Nested Class Summary | |
---|---|
(package private) static class |
TransformerImpl.MessageHandler
This class wraps an ErrorListener into a MessageHandler in order to capture messages reported via xsl:message. |
Field Summary | |
---|---|
private DOM |
_dom
A reference to a internal DOM represenation of the input. |
private XSLTCDTMManager |
_dtmManager
A reference to the XSLTCDTMManager which is used to build the DOM/DTM for this transformer. |
private java.lang.String |
_encoding
The output encoding of this transformation. |
private javax.xml.transform.ErrorListener |
_errorListener
An error listener for runtime errors. |
private int |
_indentNumber
Number of indent spaces to add when indentation is on. |
private boolean |
_isIdentity
A flag indicating whether this transformer implements the identity transform. |
private boolean |
_isSecureProcessing
State of the secure processing feature. |
private java.lang.String |
_method
The output method of this transformation. |
private java.io.OutputStream |
_ostream
A reference to the output stream, if we create one in our code. |
private Hashtable |
_parameters
A hashtable to store parameters for the identity transform. |
private java.util.Properties |
_properties
Output properties of this transformer instance. |
private java.util.Properties |
_propertiesClone
Output properties of this transformer instance. |
private XMLReaderManager |
_readerManager
A reference to an object that creates and caches XMLReader objects. |
private java.lang.String |
_sourceSystemId
The systemId set in input source. |
private TransformerFactoryImpl |
_tfactory
A reference to the transformer factory that this templates object belongs to. |
private TransletOutputHandlerFactory |
_tohFactory
A reference to an output handler factory. |
private AbstractTranslet |
_translet
A reference to the translet or null if the identity transform. |
private javax.xml.transform.URIResolver |
_uriResolver
A reference to a URI resolver for calls to document(). |
private static java.lang.String |
EMPTY_STRING
|
private static java.lang.String |
LEXICAL_HANDLER_PROPERTY
|
private static java.lang.String |
NAMESPACE_FEATURE
|
private static java.lang.String |
NO_STRING
|
private static java.lang.String |
XML_STRING
|
private static java.lang.String |
YES_STRING
|
Constructor Summary | |
---|---|
protected |
TransformerImpl(java.util.Properties outputProperties,
int indentNumber,
TransformerFactoryImpl tfactory)
|
protected |
TransformerImpl(Translet translet,
java.util.Properties outputProperties,
int indentNumber,
TransformerFactoryImpl tfactory)
|
Method Summary | |
---|---|
void |
clearParameters()
Implements JAXP's Transformer.clearParameters() Clear all parameters set with setParameter. |
private java.util.Properties |
createOutputProperties(java.util.Properties outputProperties)
Internal method to create the initial set of properties. |
void |
error(javax.xml.transform.TransformerException e)
Receive notification of a recoverable error. |
void |
fatalError(javax.xml.transform.TransformerException e)
Receive notification of a non-recoverable error. |
private DOM |
getDOM(javax.xml.transform.Source source)
Builds an internal DOM from a TrAX Source object |
javax.xml.transform.ErrorListener |
getErrorListener()
Implements JAXP's Transformer.getErrorListener() Get the error event handler in effect for the transformation. |
SerializationHandler |
getOutputHandler(javax.xml.transform.Result result)
Create an output handler for the transformation output based on the type and contents of the TrAX Result object passed to the transform() method. |
java.util.Properties |
getOutputProperties()
Implements JAXP's Transformer.getOutputProperties(). |
java.lang.String |
getOutputProperty(java.lang.String name)
Implements JAXP's Transformer.getOutputProperty(). |
java.lang.Object |
getParameter(java.lang.String name)
Implements JAXP's Transformer.getParameter() Returns the value of a given parameter. |
protected TransformerFactoryImpl |
getTransformerFactory()
Returns the TransformerFactoryImpl
object that create this Transformer . |
protected AbstractTranslet |
getTranslet()
Returns the translet wrapped inside this Transformer or null if this is the identity transform. |
protected TransletOutputHandlerFactory |
getTransletOutputHandlerFactory()
Returns the TransletOutputHandlerFactory
object that create the TransletOutputHandler . |
javax.xml.transform.URIResolver |
getURIResolver()
Implements JAXP's Transformer.getURIResolver() Set the object currently used to resolve URIs used in document(). |
private boolean |
isDefaultProperty(java.lang.String name,
java.util.Properties properties)
Checks if a given output property is default (2nd layer only) |
boolean |
isIdentity()
|
boolean |
isSecureProcessing()
Return the state of the secure processing feature. |
private java.lang.String |
makeCDATAString(Hashtable cdata)
The translet stores all CDATA sections set in the |
private void |
postErrorToListener(java.lang.String message)
Inform TrAX error listener of an error |
private void |
postWarningToListener(java.lang.String message)
Inform TrAX error listener of a warning |
void |
reset()
This method resets the Transformer to its original configuration Transformer code is reset to the same state it was when it was created |
DOM |
retrieveDocument(java.lang.String baseURI,
java.lang.String href,
Translet translet)
This class should only be used as a DOMCache for the translet if the URIResolver has been set. |
private void |
setDefaults(java.util.Properties props,
java.lang.String method)
Internal method to get the default properties from the serializer factory and set them on the property object. |
protected void |
setDOM(DOM dom)
Set the internal DOM that will be used for the next transformation |
void |
setErrorListener(javax.xml.transform.ErrorListener listener)
Implements JAXP's Transformer.setErrorListener() Set the error event listener in effect for the transformation. |
void |
setOutputProperties(java.util.Properties properties)
Implements JAXP's Transformer.setOutputProperties(). |
void |
setOutputProperty(java.lang.String name,
java.lang.String value)
Implements JAXP's Transformer.setOutputProperty(). |
void |
setParameter(java.lang.String name,
java.lang.Object value)
Implements JAXP's Transformer.setParameter() Add a parameter for the transformation. |
void |
setSecureProcessing(boolean flag)
Set the state of the secure processing feature. |
void |
setURIResolver(javax.xml.transform.URIResolver resolver)
Implements JAXP's Transformer.setURIResolver() Set an object that will be used to resolve URIs used in document(). |
private void |
transferOutputProperties(AbstractTranslet translet)
Internal method to pass any properties to the translet prior to initiating the transformation |
void |
transferOutputProperties(SerializationHandler handler)
This method is used to pass any properties to the output handler when running the identity transform. |
void |
transform(javax.xml.transform.Source source,
javax.xml.transform.Result result)
Implements JAXP's Transformer.transform() |
private void |
transform(javax.xml.transform.Source source,
SerializationHandler handler,
java.lang.String encoding)
Internal transformation method - uses the internal APIs of XSLTC |
private void |
transformIdentity(javax.xml.transform.Source source,
SerializationHandler handler)
|
private boolean |
validOutputProperty(java.lang.String name)
Verifies if a given output property name is a property defined in the JAXP 1.1 / TrAX spec |
void |
warning(javax.xml.transform.TransformerException e)
Receive notification of a warning. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final java.lang.String EMPTY_STRING
private static final java.lang.String NO_STRING
private static final java.lang.String YES_STRING
private static final java.lang.String XML_STRING
private static final java.lang.String LEXICAL_HANDLER_PROPERTY
private static final java.lang.String NAMESPACE_FEATURE
private AbstractTranslet _translet
private java.lang.String _method
private java.lang.String _encoding
private java.lang.String _sourceSystemId
private javax.xml.transform.ErrorListener _errorListener
private javax.xml.transform.URIResolver _uriResolver
private java.util.Properties _properties
private java.util.Properties _propertiesClone
private TransletOutputHandlerFactory _tohFactory
private DOM _dom
private int _indentNumber
private TransformerFactoryImpl _tfactory
private java.io.OutputStream _ostream
private XSLTCDTMManager _dtmManager
private XMLReaderManager _readerManager
private boolean _isIdentity
private boolean _isSecureProcessing
private Hashtable _parameters
Constructor Detail |
---|
protected TransformerImpl(java.util.Properties outputProperties, int indentNumber, TransformerFactoryImpl tfactory)
protected TransformerImpl(Translet translet, java.util.Properties outputProperties, int indentNumber, TransformerFactoryImpl tfactory)
Method Detail |
---|
public boolean isSecureProcessing()
public void setSecureProcessing(boolean flag)
protected AbstractTranslet getTranslet()
public boolean isIdentity()
public void transform(javax.xml.transform.Source source, javax.xml.transform.Result result) throws javax.xml.transform.TransformerException
transform
in class javax.xml.transform.Transformer
source
- Contains the input XML documentresult
- Will contain the output from the transformation
javax.xml.transform.TransformerException
public SerializationHandler getOutputHandler(javax.xml.transform.Result result) throws javax.xml.transform.TransformerException
javax.xml.transform.TransformerException
protected void setDOM(DOM dom)
private DOM getDOM(javax.xml.transform.Source source) throws javax.xml.transform.TransformerException
javax.xml.transform.TransformerException
protected TransformerFactoryImpl getTransformerFactory()
TransformerFactoryImpl
object that create this Transformer
.
protected TransletOutputHandlerFactory getTransletOutputHandlerFactory()
TransletOutputHandlerFactory
object that create the TransletOutputHandler
.
private void transformIdentity(javax.xml.transform.Source source, SerializationHandler handler) throws java.lang.Exception
java.lang.Exception
private void transform(javax.xml.transform.Source source, SerializationHandler handler, java.lang.String encoding) throws javax.xml.transform.TransformerException
javax.xml.transform.TransformerException
public javax.xml.transform.ErrorListener getErrorListener()
getErrorListener
in class javax.xml.transform.Transformer
public void setErrorListener(javax.xml.transform.ErrorListener listener) throws java.lang.IllegalArgumentException
setErrorListener
in class javax.xml.transform.Transformer
listener
- The error event listener to use
java.lang.IllegalArgumentException
private void postErrorToListener(java.lang.String message)
private void postWarningToListener(java.lang.String message)
private java.lang.String makeCDATAString(Hashtable cdata)
public java.util.Properties getOutputProperties()
getOutputProperties
in class javax.xml.transform.Transformer
public java.lang.String getOutputProperty(java.lang.String name) throws java.lang.IllegalArgumentException
getOutputProperty
in class javax.xml.transform.Transformer
name
- A non-null string that contains the name of the property
java.lang.IllegalArgumentException
- if the property name is not knownpublic void setOutputProperties(java.util.Properties properties) throws java.lang.IllegalArgumentException
setOutputProperties
in class javax.xml.transform.Transformer
properties
- The properties to use for the Transformer
java.lang.IllegalArgumentException
- Never, errors are ignoredpublic void setOutputProperty(java.lang.String name, java.lang.String value) throws java.lang.IllegalArgumentException
setOutputProperty
in class javax.xml.transform.Transformer
name
- The name of the property to setvalue
- The value to assign to the property
java.lang.IllegalArgumentException
- Never, errors are ignoredprivate void transferOutputProperties(AbstractTranslet translet)
public void transferOutputProperties(SerializationHandler handler)
private java.util.Properties createOutputProperties(java.util.Properties outputProperties)
private void setDefaults(java.util.Properties props, java.lang.String method)
props
- a java.util.Property object on which the properties are set.method
- The output method type, one of "xml", "text", "html" ...private boolean validOutputProperty(java.lang.String name)
private boolean isDefaultProperty(java.lang.String name, java.util.Properties properties)
public void setParameter(java.lang.String name, java.lang.Object value)
setParameter
in class javax.xml.transform.Transformer
name
- The name of the parametervalue
- The value to assign to the parameterpublic void clearParameters()
clearParameters
in class javax.xml.transform.Transformer
public final java.lang.Object getParameter(java.lang.String name)
getParameter
in class javax.xml.transform.Transformer
name
- The name of the parameter
public javax.xml.transform.URIResolver getURIResolver()
getURIResolver
in class javax.xml.transform.Transformer
public void setURIResolver(javax.xml.transform.URIResolver resolver)
setURIResolver
in class javax.xml.transform.Transformer
resolver
- The URIResolver to use in document()public DOM retrieveDocument(java.lang.String baseURI, java.lang.String href, Translet translet)
retrieveDocument
in interface DOMCache
baseURI
- The base URI used by the document call.href
- The href argument passed to the document function.translet
- A reference to the translet requesting the documentpublic void error(javax.xml.transform.TransformerException e) throws javax.xml.transform.TransformerException
error
in interface javax.xml.transform.ErrorListener
e
- The warning information encapsulated in a transformer
exception.
javax.xml.transform.TransformerException
- if the application chooses to discontinue
the transformation (always does in our case).public void fatalError(javax.xml.transform.TransformerException e) throws javax.xml.transform.TransformerException
fatalError
in interface javax.xml.transform.ErrorListener
e
- The warning information encapsulated in a transformer
exception.
javax.xml.transform.TransformerException
- if the application chooses to discontinue
the transformation (always does in our case).public void warning(javax.xml.transform.TransformerException e) throws javax.xml.transform.TransformerException
warning
in interface javax.xml.transform.ErrorListener
e
- The warning information encapsulated in a transformer
exception.
javax.xml.transform.TransformerException
- if the application chooses to discontinue
the transformation (never does in our case).public void reset()
reset
in class javax.xml.transform.Transformer
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |