public class IdentityTransformer extends Transformer
Modifier | Constructor and Description |
---|---|
protected |
IdentityTransformer(Configuration config) |
Modifier and Type | Method and Description |
---|---|
void |
clearParameters()
Clear all parameters set with setParameter.
|
Configuration |
getConfiguration() |
ErrorListener |
getErrorListener()
Get the error event handler in effect for the transformation.
|
protected Properties |
getLocalOutputProperties()
Get the local output properties held in this Transformer object, that is the properties
explicitly requested using setOutputProperty() or setOutputProperties()
|
Properties |
getOutputProperties()
Get the output properties for the transformation.
|
String |
getOutputProperty(String name)
Get an output property that is in effect for the transformer.
|
Object |
getParameter(String name)
Get a parameter that was explicitly set with setParameter.
|
protected Properties |
getStylesheetOutputProperties()
Get the output properties defined in the stylesheet.
|
URIResolver |
getURIResolver()
Get an object that will be used to resolve URIs used in
document().
|
protected void |
reportFatalError(XPathException err) |
void |
reset()
Reset this
Transformer to its original configuration. |
void |
setErrorListener(ErrorListener listener)
Set the error event listener in effect for the transformation.
|
void |
setOutputProperties(Properties properties)
Set the output properties for the transformation.
|
void |
setOutputProperty(String name,
String value)
Set an output property that will be in effect for the
transformation.
|
void |
setParameter(String name,
Object value)
Add a parameter for the transformation.
|
void |
setURIResolver(URIResolver resolver)
Set an object that will be used to resolve URIs used in
document().
|
void |
transform(Source source,
Result result)
Perform identify transformation from Source to Result
|
protected IdentityTransformer(Configuration config)
public void reset()
Reset this Transformer
to its original configuration.
Transformer
is reset to the same state as when it was created with
TransformerFactory.newTransformer()
,
TransformerFactory.newTransformer(javax.xml.transform.Source source)
or
Templates.newTransformer()
.
reset()
is designed to allow the reuse of existing Transformer
s
thus saving resources associated with the creation of new Transformer
s.
The reset Transformer
is not guaranteed to have the same URIResolver
or ErrorListener
Object
s, e.g. Object.equals(Object obj)
.
It is guaranteed to have a functionally equal URIResolver
and ErrorListener
.
reset
in class Transformer
UnsupportedOperationException
- When implementation does not
override this method.public void setURIResolver(URIResolver resolver)
If the resolver argument is null, the URIResolver value will be cleared and the transformer will no longer have a resolver.
setURIResolver
in class Transformer
resolver
- An object that implements the URIResolver interface,
or null.public URIResolver getURIResolver()
getURIResolver
in class Transformer
public void setErrorListener(ErrorListener listener) throws IllegalArgumentException
setErrorListener
in class Transformer
listener
- The new error listener.IllegalArgumentException
- if listener is null.public ErrorListener getErrorListener()
getErrorListener
in class Transformer
public void setOutputProperties(Properties properties)
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 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.
An IllegalArgumentException
is thrown if any of the
argument keys are not recognized and are not namespace qualified.
As well as the properties defined in the JAXP OutputKeys class,
Saxon defines an additional set of properties in SaxonOutputKeys
.
These fall into two categories: Constants representing serialization
properties defined in XSLT 2.0 (which are not yet supported by JAXP),
and constants supporting Saxon extensions to the set of serialization
setOutputProperties
in class Transformer
properties
- A set of output properties that will be
used to override any of the same properties in affect
for the transformation.IllegalArgumentException
- When keys are not recognized and
are not namespace qualified.OutputKeys
,
Properties
public Properties getOutputProperties()
SaxonOutputKeys
.
These fall into two categories: Constants representing serialization
properties defined in XSLT 2.0 (which are not yet supported by JAXP),
and constants supporting Saxon extensions to the set of serialization
properties.getOutputProperties
in class Transformer
SaxonOutputKeys
protected Properties getStylesheetOutputProperties()
protected Properties getLocalOutputProperties()
public String getOutputProperty(String name) throws IllegalArgumentException
Get an output property that is in effect for the transformer.
If a property has been set using setOutputProperty(java.lang.String, java.lang.String)
,
that value will be returned. Otherwise, if a property is explicitly
specified in the stylesheet, that value will be returned. If
the value of the property has been defaulted, that is, if no
value has been set explicitly either with setOutputProperty(java.lang.String, java.lang.String)
or
in the stylesheet, the result may vary depending on
implementation and input stylesheet.
getOutputProperty
in class Transformer
name
- A non-null String that specifies an output
property name, which may be namespace qualified.IllegalArgumentException
- If the property is not supported.OutputKeys
public void setOutputProperty(String name, String value) throws IllegalArgumentException
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 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.
The Properties object that was passed to setOutputProperties(java.util.Properties)
won't be effected by calling this method.
setOutputProperty
in class Transformer
name
- 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.IllegalArgumentException
- If the property is not supported, and is
not qualified with a namespace.OutputKeys
public void setParameter(String name, 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 Transformer
name
- The 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.NullPointerException
- If value is null.public Object getParameter(String name)
This method does not return a default parameter value, which cannot be determined until the node context is evaluated during the transformation process.
The Saxon implementation for an IdentityTransformer always returns null, since parameters have no effect on an identity transformation.
getParameter
in class Transformer
name
- of Object
to getpublic void clearParameters()
clearParameters
in class Transformer
public void transform(Source source, Result result) throws TransformerException
transform
in class Transformer
TransformerException
public Configuration getConfiguration()
protected void reportFatalError(XPathException err)
Copyright (c) 2004-2014 Saxonica Limited. All rights reserved.