public class JXTransformer extends Transformer
An instance of this class can be obtained with the
TransformerFactory.newTransformer method. This instance may
then be used to process XML from a variety of sources and write
the transformation output to a variety of sinks.
An object of this class may not be used in multiple threads running concurrently. Different Transformers may be used concurrently by different threads.
A Transformer may be used multiple times. Parameters and output properties are preserved across transformations.
| Constructor and Description |
|---|
JXTransformer()
Default constructor
|
JXTransformer(XSLStylesheet templates)
Constructor is based on
|
| Modifier and Type | Method and Description |
|---|---|
void |
clearParameters()
Clear all parameters set with setParameter.
|
ErrorListener |
getErrorListener()
Get the error event handler in effect for the transformation.
|
java.util.Properties |
getOutputProperties()
Get a copy of the output properties for the transformation.
|
java.lang.String |
getOutputProperty(java.lang.String name)
Get an output property that is in effect for the
transformation.
|
oracle.xml.xslt.OutputURIResolver |
getOutputURIResolver() |
java.lang.Object |
getParameter(java.lang.String name)
Get a parameter that was explicitly set with setParameter
or setParameters.
|
URIResolver |
getURIResolver()
Get an object that will be used to resolve URIs used in
document(), etc.
|
void |
setErrorListener(ErrorListener listener)
Set the error event listener in effect for the transformation.
|
void |
setGenerate_Output_Escaping_PIs(boolean bool)
By default, When Oracle JAXP XSLT transformer transforms
an XML into a Result, it does not generate
Result.PI_DISABLE_OUTPUT_ESCAPING and
Result.PI_ENABLE_OUTPUT_ESCAPING PIs based on the stylesheet.
|
void |
setOutputProperties(java.util.Properties oformat)
Set the output properties for the transformation.
|
void |
setOutputProperty(java.lang.String name,
java.lang.String value)
Set an output property that will be in effect for the
transformation.
|
void |
setOutputURIResolver(oracle.xml.xslt.OutputURIResolver resolver) |
void |
setParameter(java.lang.String name,
java.lang.Object value)
Add a parameter for the transformation.
|
void |
setTransformMonitor(oracle.xml.xslt.TransformMonitor transformMonitor) |
void |
setURIResolver(URIResolver resolver)
Set an object that will be used to resolve URIs used in
document().
|
void |
transform(Source source,
Result result)
Process the source tree to the output result.
|
public JXTransformer()
public JXTransformer(XSLStylesheet templates)
templates - a XSLStylesheet or Templatespublic void setGenerate_Output_Escaping_PIs(boolean bool)
bool - : false if disable generating the PIs (default)
true if enable generating the PIspublic void transform(Source source, Result result) throws TransformerException
transform in class Transformersource - The input for the source tree.result - The output target.TransformerException - If an unrecoverable error occurs
during the course of the transformation.public void setParameter(java.lang.String name,
java.lang.Object value)
Pass a qualified name as a two-part string, the namespace URI enclosed in curly braces ({}), followed by the local name. If the name has a null URL, the String only contain the local name. An application can safely check for a non-null URI by testing to see if the first character of the name is a '{' character.
For example, if a URI and local name were obtained from an element defined with <xyz:foo xmlns:xyz="http://xyz.foo.com/yada/baz.html"/>, then the qualified name would be "{http://xyz.foo.com/yada/baz.html}foo". Note that no prefix is used.
setParameter in class Transformername - Name of the parameter, which may begin with a namespace URI
in curly braces ({}).value - The value object. This can be any valid Java object. It is
up to the processor to provide the proper object coersion or to simply
pass the object on for use in an extension.public java.lang.Object getParameter(java.lang.String name)
getParameter in class Transformername - A parameter name
This method does not return a default parameter value, which cannot be determined until the node context is evaluated during the transformation process.
public void clearParameters()
clearParameters in class Transformerpublic void setURIResolver(URIResolver resolver)
If the resolver argument is null, the URIResolver value will be cleared, and the default behavior will be used.
setURIResolver in class Transformerresolver - An object that implements the URIResolver interface,
or null.public void setOutputURIResolver(oracle.xml.xslt.OutputURIResolver resolver)
public URIResolver getURIResolver()
getURIResolver in class Transformerpublic oracle.xml.xslt.OutputURIResolver getOutputURIResolver()
public void setOutputProperties(java.util.Properties oformat)
If argument to this function is null, any properties previously set are removed, and the value will revert to the value defined in the templates object.
Pass a qualified property key name as a two-part string, the namespace URI enclosed in curly braces ({}), followed by the local name. If the name has a null URL, the String only contain the local name. An application can safely check for a non-null URI by testing to see if the first character of the name is a '{' character.
For ex, if a URI and local name were obtained from an element defined with <xyz:foo xmlns:xyz="http://xyz.foo.com/yada/baz.html"/>, then the qualified name would be "{http://xyz.foo.com/yada/baz.html}foo". Note that no prefix is used.
setOutputProperties in class Transformeroformat - A set of output properties that will be
used to override any of the same properties in affect
for the transformation.java.lang.IllegalArgumentException - if any of the argument keys are not
recognized and are not namespace qualified.OutputKeys,
Propertiespublic java.util.Properties getOutputProperties()
The properties returned should contain properties set by the user,
and properties set by the stylesheet, and these properties
are "defaulted" by default properties specified by
section 16 of the
XSL Transformations (XSLT) W3C Recommendation. The properties that
were specifically set by the user or the stylesheet should be in the base
Properties list, while the XSLT default properties that were not
specifically set should be the default Properties list. Thus,
getOutputProperties().getProperty(String key) will obtain any
property in that was set by setOutputProperty(java.lang.String, java.lang.String),
setOutputProperties(java.util.Properties), in the stylesheet, or the default
properties, while
getOutputProperties().get(String key) will only retrieve properties
that were explicitly set by setOutputProperty(java.lang.String, java.lang.String),
setOutputProperties(java.util.Properties), or in the stylesheet.
Note that mutation of the Properties object returned will not effect the properties that the transformation contains.
If any of the argument keys are not recognized and are not namespace qualified, the property will be ignored. In other words the behaviour is not orthogonal with setOutputProperties.
getOutputProperties in class TransformerOutputKeys,
Propertiespublic void setOutputProperty(java.lang.String name,
java.lang.String value)
Pass a qualified property name as a two-part string, the namespace URI enclosed in curly braces ({}), followed by the local name. If the name has a null URL, the String only contain the local name. An application can safely check for a non-null URI by testing to see if the first character of the name is a '{' character.
For ex, if a URI and local name were obtained from an element defined with <xyz:foo xmlns:xyz="http://xyz.foo.com/yada/baz.html"/>, then the qualified name would be "{http://xyz.foo.com/yada/baz.html}foo". Note that no prefix is used.
The Properties object that was passed to setOutputProperties(java.util.Properties)
won't be effected by calling this method.
setOutputProperty in class Transformername - A non-null String that specifies an output
property name, which may be namespace qualified.value - The non-null string value of the output property.java.lang.IllegalArgumentException - If the property is not supported, and is
not qualified with a namespace.OutputKeyspublic java.lang.String getOutputProperty(java.lang.String name)
getOutputProperty in class Transformername - A non-null String that specifies an output
property name, which may be namespace qualified.java.lang.IllegalArgumentException - If the property is not supported.OutputKeyspublic void setErrorListener(ErrorListener listener)
setErrorListener in class Transformerlistener - The new error listener.java.lang.IllegalArgumentException - if listener is null.public ErrorListener getErrorListener()
getErrorListener in class Transformerpublic void setTransformMonitor(oracle.xml.xslt.TransformMonitor transformMonitor)
Copyright © 2003, 2025, Oracle and/or its affiliates.