Top Inners Fields Constructors Methods
com.sun.org.apache.xalan.internal.xsltc.trax

public final Class TransformerImpl

extends Transformer
implements DOMCache
Class Inheritance
All Implemented Interfaces
com.sun.org.apache.xalan.internal.xsltc.DOMCache
Imports
com.sun.org.apache.xalan.internal.xsltc.DOM, .DOMCache, .StripFilter, .Translet, .TransletException, com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg, com.sun.org.apache.xalan.internal.xsltc.dom.DOMWSFilter, .SAXImpl, .XSLTCDTMManager, com.sun.org.apache.xalan.internal.xsltc.runtime.AbstractTranslet, com.sun.org.apache.xalan.internal.xsltc.runtime.output.TransletOutputHandlerFactory, com.sun.org.apache.xml.internal.dtm.DTMWSFilter, com.sun.org.apache.xml.internal.serializer.OutputPropertiesFactory, .SerializationHandler, com.sun.org.apache.xml.internal.utils.SystemIDResolver, .XMLReaderManager, java.io.File, .FileOutputStream, .IOException, .InputStream, .OutputStream, .Reader, .Writer, java.net.URI, .URL, .URLConnection, .UnknownServiceException, java.nio.file.Path, .Paths, java.util.ArrayList, .Enumeration, .HashMap, .List, .Map, .Properties, .StringTokenizer, javax.xml.XMLConstants, javax.xml.catalog.CatalogException, .CatalogFeatures, .CatalogManager, .CatalogResolver, javax.xml.parsers.DocumentBuilder, .DocumentBuilderFactory, .ParserConfigurationException, javax.xml.stream.XMLEventReader, .XMLStreamReader, javax.xml.transform.ErrorListener, .OutputKeys, .Result, .Source, .Transformer, .TransformerException, .URIResolver, javax.xml.transform.dom.DOMResult, .DOMSource, javax.xml.transform.sax.SAXResult, .SAXSource, javax.xml.transform.stax.StAXResult, .StAXSource, javax.xml.transform.stream.StreamResult, .StreamSource, jdk.xml.internal.JdkConstants, .JdkProperty, .JdkXmlFeatures, .JdkXmlUtils, .JdkProperty.ImplPropMap, .JdkProperty.State, .XMLSecurityManager, .SecuritySupport, .TransformErrorListener, org.xml.sax.ContentHandler, .InputSource, .SAXException, .XMLReader, org.xml.sax.ext.LexicalHandler

Authors
Morten Jorgensen, G. Todd Miller, Santiago Pericas-Geertsen

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
TransformerImpl.MessageHandler

This class wraps an ErrorListener into a MessageHandler in order to capture messages reported via xsl:message.

Field Summary

Modifier and TypeField and Description
private String
_accessExternalDTD

protocols allowed for external DTD references in source file and/or stylesheet.

pack-priv CatalogFeatures
pack-priv CatalogResolver
pack-priv int
private final ErrorListener
_defaultListener

Default error listener

private DOM
_dom

A reference to a internal DOM representation of the input.

private XSLTCDTMManager
_dtmManager

A reference to the XSLTCDTMManager which is used to build the DOM/DTM for this transformer.

private String
_encoding

The output encoding of this transformation.

private 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 String
_method

The output method of this transformation.

private OutputStream
_ostream

A reference to the output stream, if we create one in our code.

private boolean
_overrideDefaultParser

Indicates whether 3rd party parser may be used to override the system-default

private Map<String, Object>
_parameters

A map to store parameters for the identity transform.

private Properties
_properties

Output properties of this transformer instance.

private Properties
_propertiesClone

Output properties of this transformer instance.

private XMLReaderManager
_readerManager

A reference to an object that creates and caches XMLReader objects.

protected XMLSecurityManager
private 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 URIResolver
_uriResolver

A reference to a URI resolver for calls to document().

pack-priv boolean
pack-priv JdkProperty<String>
private static final String
private static final String
NAMESPACE_PREFIXES_FEATURE

Namespace prefixes feature for XMLReader.

Constructor Summary

AccessConstructor and Description
protected
TransformerImpl(Properties outputProperties, int indentNumber, TransformerFactoryImpl tfactory)

protected
TransformerImpl(Translet translet, Properties outputProperties, int indentNumber, TransformerFactoryImpl tfactory)

Method Summary

Modifier and TypeMethod and Description
public void
clearParameters()

Implements abstract javax.xml.transform.Transformer.clearParameters.

Implements JAXP's Transformer.clearParameters() Clear all parameters set with setParameter.

private Properties
createOutputProperties(Properties outputProperties)

Internal method to create the initial set of properties.

private DOM
getDOM(Source source)

Builds an internal DOM from a TrAX Source object

public ErrorListener

Returns:

The error event handler currently in effect
getErrorListener
()

Implements abstract javax.xml.transform.Transformer.getErrorListener.

Implements JAXP's Transformer.getErrorListener() Get the error event handler in effect for the transformation.

public SerializationHandler
getOutputHandler(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.

public Properties

Returns:

Properties in effect for this Transformer
getOutputProperties
()

Implements abstract javax.xml.transform.Transformer.getOutputProperties.

Implements JAXP's Transformer.getOutputProperties().

public String
getOutputProperty(String
A non-null string that contains the name of the property
name
)

Implements abstract javax.xml.transform.Transformer.getOutputProperty.

Implements JAXP's Transformer.getOutputProperty().

public final Object

Returns:

An object that contains the value assigned to the parameter
getParameter
(String
The name of the parameter
name
)

Implements abstract javax.xml.transform.Transformer.getParameter.

Implements JAXP's Transformer.getParameter() Returns the value of a given parameter.

protected TransformerFactoryImpl
protected AbstractTranslet
getTranslet()

Returns the translet wrapped inside this Transformer or null if this is the identity transform.

protected TransletOutputHandlerFactory
public URIResolver

Returns:

The URLResolver object currently in use
getURIResolver
()

Implements abstract javax.xml.transform.Transformer.getURIResolver.

Implements JAXP's Transformer.getURIResolver() Set the object currently used to resolve URIs used in document().

private boolean
isDefaultProperty(String name, Properties properties)

Checks if a given output property is default (2nd layer only)

public boolean
public boolean
isSecureProcessing()

Return the state of the secure processing feature.

public boolean
overrideDefaultParser()

Return the state of the services mechanism feature.

private void
postErrorToListener(String message)

Inform TrAX error listener of an error

private void
postWarningToListener(String message)

Inform TrAX error listener of a warning

public void
reset()

Overrides javax.xml.transform.Transformer.reset.

This method resets the Transformer to its original configuration Transformer code is reset to the same state it was when it was created

public DOM
retrieveDocument(String
The base URI used by the document call.
baseURI
,
String
The href argument passed to the document function.
href
,
Translet
A reference to the translet requesting the document
translet
)

Implements com.sun.org.apache.xalan.internal.xsltc.DOMCache.retrieveDocument.

This class should only be used as a DOMCache for the translet if the URIResolver has been set.

private void
setDefaults(Properties
a java.util.Property object on which the properties are set.
props
,
String
The output method type, one of "xml", "text", "html" ...
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

public void
setErrorListener(ErrorListener
The error event listener to use
listener
)

Implements abstract javax.xml.transform.Transformer.setErrorListener.

Implements JAXP's Transformer.setErrorListener() Set the error event listener in effect for the transformation.

public void
setOutputProperties(Properties
The properties to use for the Transformer
properties
)

Implements abstract javax.xml.transform.Transformer.setOutputProperties.

Implements JAXP's Transformer.setOutputProperties().

public void
setOutputProperty(String
The name of the property to set
name
,
String
The value to assign to the property
value
)

Implements abstract javax.xml.transform.Transformer.setOutputProperty.

Implements JAXP's Transformer.setOutputProperty().

public void
setOverrideDefaultParser(boolean flag)

Set the state of the services mechanism feature.

public void
setParameter(String
The name of the parameter
name
,
Object
The value to assign to the parameter
value
)

Implements abstract javax.xml.transform.Transformer.setParameter.

Implements JAXP's Transformer.setParameter() Add a parameter for the transformation.

public void
setSecureProcessing(boolean flag)

Set the state of the secure processing feature.

public void
setURIResolver(URIResolver
The URIResolver to use in document()
resolver
)

Implements abstract javax.xml.transform.Transformer.setURIResolver.

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

public void
transferOutputProperties(SerializationHandler handler)

This method is used to pass any properties to the output handler when running the identity transform.

public void
transform(Source
Contains the input XML document
source
,
Result
Will contain the output from the transformation
result
)

Implements abstract javax.xml.transform.Transformer.transform.

Implements JAXP's Transformer.transform()

private void
transform(Source source, SerializationHandler handler, String encoding)

Internal transformation method - uses the internal APIs of XSLTC

private void
private boolean
validOutputProperty(String name)

Verifies if a given output property name is a property defined in the JAXP 1.1 / TrAX spec

Field Detail

_accessExternalDTDback to summary
private String _accessExternalDTD

protocols allowed for external DTD references in source file and/or stylesheet.

_catalogFeaturesback to summary
pack-priv CatalogFeatures _catalogFeatures
_catalogUriResolverback to summary
pack-priv CatalogResolver _catalogUriResolver
_cdataChunkSizeback to summary
pack-priv int _cdataChunkSize
_defaultListenerback to summary
private final ErrorListener _defaultListener

Default error listener

_domback to summary
private DOM _dom

A reference to a internal DOM representation of the input.

_dtmManagerback to summary
private XSLTCDTMManager _dtmManager

A reference to the XSLTCDTMManager which is used to build the DOM/DTM for this transformer.

_encodingback to summary
private String _encoding

The output encoding of this transformation.

_errorListenerback to summary
private ErrorListener _errorListener

An error listener for runtime errors.

_indentNumberback to summary
private int _indentNumber

Number of indent spaces to add when indentation is on.

_isIdentityback to summary
private boolean _isIdentity

A flag indicating whether this transformer implements the identity transform.

_isSecureProcessingback to summary
private boolean _isSecureProcessing

State of the secure processing feature.

_methodback to summary
private String _method

The output method of this transformation.

_ostreamback to summary
private OutputStream _ostream

A reference to the output stream, if we create one in our code.

_overrideDefaultParserback to summary
private boolean _overrideDefaultParser

Indicates whether 3rd party parser may be used to override the system-default

_parametersback to summary
private Map<String, Object> _parameters

A map to store parameters for the identity transform. These are not needed during the transformation, but we must keep track of them to be fully complaint with the JAXP API.

_propertiesback to summary
private Properties _properties

Output properties of this transformer instance.

_propertiesCloneback to summary
private Properties _propertiesClone

Output properties of this transformer instance.

_readerManagerback to summary
private XMLReaderManager _readerManager

A reference to an object that creates and caches XMLReader objects.

_securityManagerback to summary
protected XMLSecurityManager _securityManager
_sourceSystemIdback to summary
private String _sourceSystemId

The systemId set in input source.

_tfactoryback to summary
private TransformerFactoryImpl _tfactory

A reference to the transformer factory that this templates object belongs to.

_tohFactoryback to summary
private TransletOutputHandlerFactory _tohFactory

A reference to an output handler factory.

_transletback to summary
private AbstractTranslet _translet

A reference to the translet or null if the identity transform.

_uriResolverback to summary
private URIResolver _uriResolver

A reference to a URI resolver for calls to document().

_useCatalogback to summary
pack-priv boolean _useCatalog
_xsltcIsStandaloneback to summary
pack-priv JdkProperty<String> _xsltcIsStandalone
LEXICAL_HANDLER_PROPERTYback to summary
private static final String LEXICAL_HANDLER_PROPERTY
NAMESPACE_PREFIXES_FEATUREback to summary
private static final String NAMESPACE_PREFIXES_FEATURE

Namespace prefixes feature for XMLReader.

Constructor Detail

TransformerImplback to summary
protected TransformerImpl(Properties outputProperties, int indentNumber, TransformerFactoryImpl tfactory)
TransformerImplback to summary
protected TransformerImpl(Translet translet, Properties outputProperties, int indentNumber, TransformerFactoryImpl tfactory)

Method Detail

clearParametersback to summary
public void clearParameters()

Implements abstract javax.xml.transform.Transformer.clearParameters.

Implements JAXP's Transformer.clearParameters() Clear all parameters set with setParameter. Clears the translet's parameter stack.

Annotations
@Override
createOutputPropertiesback to summary
private Properties createOutputProperties(Properties outputProperties)

Internal method to create the initial set of properties. There are two layers of properties: the default layer and the base layer. The latter contains properties defined in the stylesheet or by the user using this API.

getDOMback to summary
private DOM getDOM(Source source) throws TransformerException

Builds an internal DOM from a TrAX Source object

getErrorListenerback to summary
public ErrorListener getErrorListener()

Implements abstract javax.xml.transform.Transformer.getErrorListener.

Implements JAXP's Transformer.getErrorListener() Get the error event handler in effect for the transformation.

Returns:ErrorListener

The error event handler currently in effect

Annotations
@Override
getOutputHandlerback to summary
public SerializationHandler getOutputHandler(Result result) throws TransformerException

Create an output handler for the transformation output based on the type and contents of the TrAX Result object passed to the transform() method.

getOutputPropertiesback to summary
public Properties getOutputProperties()

Implements abstract javax.xml.transform.Transformer.getOutputProperties.

Implements JAXP's Transformer.getOutputProperties(). Returns a copy of the output properties for the transformation. This is a set of layered properties. The first layer contains properties set by calls to setOutputProperty() and setOutputProperties() on this class, and the output settings defined in the stylesheet's <xsl:output> element makes up the second level, while the default XSLT output settings are returned on the third level.

Returns:Properties

Properties in effect for this Transformer

Annotations
@Override
getOutputPropertyback to summary
public String getOutputProperty(String name) throws IllegalArgumentException

Implements abstract javax.xml.transform.Transformer.getOutputProperty.

Implements JAXP's Transformer.getOutputProperty(). Get an output property that is in effect for the transformation. The property specified may be a property that was set with setOutputProperty, or it may be a property specified in the stylesheet.

Parameters
name:String

A non-null string that contains the name of the property

Returns:String

Doc from javax.xml.transform.Transformer.getOutputProperty.

The string value of the output property, or null if no property was found.

Annotations
@Override
Exceptions
IllegalArgumentException:
if the property name is not known
getParameterback to summary
public final Object getParameter(String name)

Implements abstract javax.xml.transform.Transformer.getParameter.

Implements JAXP's Transformer.getParameter() Returns the value of a given parameter. Note that the translet will not keep values for parameters that were not defined in the stylesheet.

Parameters
name:String

The name of the parameter

Returns:Object

An object that contains the value assigned to the parameter

Annotations
@Override
getTransformerFactoryback to summary
protected TransformerFactoryImpl getTransformerFactory()

Returns the com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl object that create this Transformer.

getTransletback to summary
protected AbstractTranslet getTranslet()

Returns the translet wrapped inside this Transformer or null if this is the identity transform.

getTransletOutputHandlerFactoryback to summary
protected TransletOutputHandlerFactory getTransletOutputHandlerFactory()

Returns the com.sun.org.apache.xalan.internal.xsltc.runtime.output.TransletOutputHandlerFactory object that create the TransletOutputHandler.

getURIResolverback to summary
public URIResolver getURIResolver()

Implements abstract javax.xml.transform.Transformer.getURIResolver.

Implements JAXP's Transformer.getURIResolver() Set the object currently used to resolve URIs used in document().

Returns:URIResolver

The URLResolver object currently in use

Annotations
@Override
isDefaultPropertyback to summary
private boolean isDefaultProperty(String name, Properties properties)

Checks if a given output property is default (2nd layer only)

isIdentityback to summary
public boolean isIdentity()
isSecureProcessingback to summary
public boolean isSecureProcessing()

Return the state of the secure processing feature.

overrideDefaultParserback to summary
public boolean overrideDefaultParser()

Return the state of the services mechanism feature.

postErrorToListenerback to summary
private void postErrorToListener(String message)

Inform TrAX error listener of an error

postWarningToListenerback to summary
private void postWarningToListener(String message)

Inform TrAX error listener of a warning

resetback to summary
public void reset()

Overrides javax.xml.transform.Transformer.reset.

This method resets the Transformer to its original configuration Transformer code is reset to the same state it was when it was created

Annotations
@Override
Since
1.5
retrieveDocumentback to summary
public DOM retrieveDocument(String baseURI, String href, Translet translet)

Implements com.sun.org.apache.xalan.internal.xsltc.DOMCache.retrieveDocument.

This class should only be used as a DOMCache for the translet if the URIResolver has been set. The method implements XSLTC's DOMCache interface, which is used to plug in an external document loader into a translet. This method acts as an adapter between TrAX's URIResolver interface and XSLTC's DOMCache interface. This approach is simple, but removes the possibility of using external document caches with XSLTC.

Parameters
baseURI:String

The base URI used by the document call.

href:String

The href argument passed to the document function.

translet:Translet

A reference to the translet requesting the document

Annotations
@Override
setDefaultsback to summary
private void setDefaults(Properties props, String method)

Internal method to get the default properties from the serializer factory and set them on the property object.

Parameters
props:Properties

a java.util.Property object on which the properties are set.

method:String

The output method type, one of "xml", "text", "html" ...

setDOMback to summary
protected void setDOM(DOM dom)

Set the internal DOM that will be used for the next transformation

setErrorListenerback to summary
public void setErrorListener(ErrorListener listener) throws IllegalArgumentException

Implements abstract javax.xml.transform.Transformer.setErrorListener.

Implements JAXP's Transformer.setErrorListener() Set the error event listener in effect for the transformation. Register a message handler in the translet in order to forward xsl:messages to error listener.

Parameters
listener:ErrorListener

The error event listener to use

Annotations
@Override
Exceptions
IllegalArgumentException:

Doc from javax.xml.transform.Transformer.setErrorListener.

if listener is null.

setOutputPropertiesback to summary
public void setOutputProperties(Properties properties) throws IllegalArgumentException

Implements abstract javax.xml.transform.Transformer.setOutputProperties.

Implements JAXP's Transformer.setOutputProperties(). Set the output properties for the transformation. These properties will override properties set in the Templates with xsl:output. Unrecognised properties will be quitely ignored.

Parameters
properties:Properties

The properties to use for the Transformer

Annotations
@Override
Exceptions
IllegalArgumentException:
Never, errors are ignored
setOutputPropertyback to summary
public void setOutputProperty(String name, String value) throws IllegalArgumentException

Implements abstract javax.xml.transform.Transformer.setOutputProperty.

Implements JAXP's Transformer.setOutputProperty(). Get an output property that is in effect for the transformation. The property specified may be a property that was set with setOutputProperty(), or it may be a property specified in the stylesheet.

Parameters
name:String

The name of the property to set

value:String

The value to assign to the property

Annotations
@Override
Exceptions
IllegalArgumentException:
Never, errors are ignored
setOverrideDefaultParserback to summary
public void setOverrideDefaultParser(boolean flag)

Set the state of the services mechanism feature.

setParameterback to summary
public void setParameter(String name, Object value)

Implements abstract javax.xml.transform.Transformer.setParameter.

Implements JAXP's Transformer.setParameter() Add a parameter for the transformation. The parameter is simply passed on to the translet - no validation is performed - so any unused parameters are quitely ignored by the translet.

Parameters
name:String

The name of the parameter

value:Object

The value to assign to the parameter

Annotations
@Override
setSecureProcessingback to summary
public void setSecureProcessing(boolean flag)

Set the state of the secure processing feature.

setURIResolverback to summary
public void setURIResolver(URIResolver resolver)

Implements abstract javax.xml.transform.Transformer.setURIResolver.

Implements JAXP's Transformer.setURIResolver() Set an object that will be used to resolve URIs used in document().

Parameters
resolver:URIResolver

The URIResolver to use in document()

Annotations
@Override
transferOutputPropertiesback to summary
private void transferOutputProperties(AbstractTranslet translet)

Internal method to pass any properties to the translet prior to initiating the transformation

transferOutputPropertiesback to summary
public void transferOutputProperties(SerializationHandler handler)

This method is used to pass any properties to the output handler when running the identity transform.

transformback to summary
public void transform(Source source, Result result) throws TransformerException

Implements abstract javax.xml.transform.Transformer.transform.

Implements JAXP's Transformer.transform()

Parameters
source:Source

Contains the input XML document

result:Result

Will contain the output from the transformation

Annotations
@Override
Exceptions
TransformerException:

Doc from javax.xml.transform.Transformer.transform.

If an unrecoverable error occurs during the course of the transformation.

transformback to summary
private void transform(Source source, SerializationHandler handler, String encoding) throws TransformerException

Internal transformation method - uses the internal APIs of XSLTC

transformIdentityback to summary
private void transformIdentity(Source source, SerializationHandler handler) throws Exception
validOutputPropertyback to summary
private boolean validOutputProperty(String name)

Verifies if a given output property name is a property defined in the JAXP 1.1 / TrAX spec

com.sun.org.apache.xalan.internal.xsltc.trax back to summary

pack-priv Class TransformerImpl.MessageHandler

extends MessageHandler
Class Inheritance

This class wraps an ErrorListener into a MessageHandler in order to capture messages reported via xsl:message.

Field Summary

Modifier and TypeField and Description
private ErrorListener

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
public ErrorListener

Field Detail

_errorListenerback to summary
private ErrorListener _errorListener

Constructor Detail

MessageHandlerback to summary
public MessageHandler(ErrorListener errorListener)

Method Detail

displayMessageback to summary
public void displayMessage(String msg)

Overrides com.sun.org.apache.xalan.internal.xsltc.runtime.MessageHandler.displayMessage.

Annotations
@Override
getErrorListenerback to summary
public ErrorListener getErrorListener()

Overrides com.sun.org.apache.xalan.internal.xsltc.runtime.MessageHandler.getErrorListener.