public class TransformerFactoryImpl extends SAXTransformerFactory
Modifier and Type | Field and Description |
---|---|
static String |
FEATURE_INCREMENTAL
Static string to be used for incremental feature
|
static String |
FEATURE_OPTIMIZE
Static string to be used for optimize feature
|
static String |
FEATURE_SOURCE_LOCATION
Static string to be used for source_location feature
|
static String |
XSLT_PROPERTIES
The path/filename of the property file: XSLTInfo.properties
Maintenance note: see also
org.apache.xpath.functions.FuncSystemProperty.XSLT_PROPERTIES |
FEATURE, FEATURE_XMLFILTER
Constructor and Description |
---|
TransformerFactoryImpl()
Constructor TransformerFactoryImpl
|
Modifier and Type | Method and Description |
---|---|
Source |
getAssociatedStylesheet(Source source,
String media,
String title,
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.
|
Object |
getAttribute(String name)
Allows the user to retrieve specific attributes on the underlying
implementation.
|
ErrorListener |
getErrorListener()
Get the error listener in effect for the TransformerFactory.
|
boolean |
getFeature(String name)
Look up the value of a feature.
|
URIResolver |
getURIResolver()
Get the object that will be used to resolve URIs used in
xsl:import, etc.
|
boolean |
isSecureProcessing()
Return the state of the secure processing feature.
|
Templates |
newTemplates(Source source)
Process the source into a Templates object, which is likely
a compiled representation of the source.
|
TemplatesHandler |
newTemplatesHandler()
Create a new Transformer object that performs a copy
of the source to the result.
|
Transformer |
newTransformer()
Create a new Transformer object that performs a copy
of the source to the result.
|
Transformer |
newTransformer(Source source)
Process the source into a Transformer object.
|
TransformerHandler |
newTransformerHandler()
Get a TransformerHandler object that can process SAX
ContentHandler events into a Result.
|
TransformerHandler |
newTransformerHandler(Source src)
Get a TransformerHandler object that can process SAX
ContentHandler events into a Result, based on the transformation
instructions specified by the argument.
|
TransformerHandler |
newTransformerHandler(Templates templates)
Get a TransformerHandler object that can process SAX
ContentHandler events into a Result, based on the Templates argument.
|
XMLFilter |
newXMLFilter(Source src)
Create an XMLFilter that uses the given source as the
transformation instructions.
|
XMLFilter |
newXMLFilter(Templates templates)
Create an XMLFilter that uses the given source as the
transformation instructions.
|
Templates |
processFromNode(Node node) |
void |
setAttribute(String name,
Object value)
Allows the user to set specific attributes on the underlying
implementation.
|
void |
setErrorListener(ErrorListener listener)
Set an error listener for the TransformerFactory.
|
void |
setFeature(String name,
boolean value)
Set a feature for this
TransformerFactory and Transformer s
or Template s created by this factory. |
void |
setURIResolver(URIResolver resolver)
Set an object that will be used to resolve URIs used in
xsl:import, etc.
|
newInstance, newInstance
public static final String XSLT_PROPERTIES
org.apache.xpath.functions.FuncSystemProperty.XSLT_PROPERTIES
public static final String FEATURE_INCREMENTAL
public static final String FEATURE_OPTIMIZE
public static final String FEATURE_SOURCE_LOCATION
public TransformerFactoryImpl()
public Templates processFromNode(Node node) throws TransformerConfigurationException
public Source getAssociatedStylesheet(Source source, String media, String title, String charset) throws TransformerConfigurationException
Note that DOM2 has it's own mechanism for discovering stylesheets. Therefore, there isn't a DOM version of this method.
getAssociatedStylesheet
in class TransformerFactory
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.TransformerConfigurationException
public TemplatesHandler newTemplatesHandler() throws TransformerConfigurationException
newTemplatesHandler
in class SAXTransformerFactory
TransformerConfigurationException
- May throw this during
the parse when it is constructing the
Templates object and fails.public void setFeature(String name, boolean value) throws TransformerConfigurationException
Set a feature for this TransformerFactory
and Transformer
s
or Template
s created by this factory.
Feature names are fully qualified URI
s.
Implementations may define their own features.
An TransformerConfigurationException
is thrown if this TransformerFactory
or the
Transformer
s or Template
s it creates cannot support the feature.
It is possible for an TransformerFactory
to expose a feature value but be unable to change its state.
See TransformerFactory
for full documentation of specific features.
setFeature
in class TransformerFactory
name
- Feature name.value
- Is feature state true
or false
.TransformerConfigurationException
- if this TransformerFactory
or the Transformer
s or Template
s it creates cannot support this feature.NullPointerException
- If the name
parameter is null.public boolean getFeature(String name)
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.
getFeature
in class TransformerFactory
name
- The feature name, which is a fully-qualified URI.public void setAttribute(String name, Object value) throws IllegalArgumentException
setAttribute
in class TransformerFactory
name
- The name of the attribute.value
- The value of the attribute; Boolean or String="true"|"false"IllegalArgumentException
- thrown if the underlying
implementation doesn't recognize the attribute.public Object getAttribute(String name) throws IllegalArgumentException
getAttribute
in class TransformerFactory
name
- The name of the attribute.IllegalArgumentException
- thrown if the underlying
implementation doesn't recognize the attribute.public XMLFilter newXMLFilter(Source src) throws TransformerConfigurationException
newXMLFilter
in class SAXTransformerFactory
src
- The source of the transformation instructions.TransformerConfigurationException
public XMLFilter newXMLFilter(Templates templates) throws TransformerConfigurationException
newXMLFilter
in class SAXTransformerFactory
templates
- non-null reference to Templates object.TransformerConfigurationException
public TransformerHandler newTransformerHandler(Source src) throws TransformerConfigurationException
newTransformerHandler
in class SAXTransformerFactory
src
- The source of the transformation instructions.TransformerConfigurationException
public TransformerHandler newTransformerHandler(Templates templates) throws TransformerConfigurationException
newTransformerHandler
in class SAXTransformerFactory
templates
- The source of the transformation instructions.TransformerConfigurationException
public TransformerHandler newTransformerHandler() throws TransformerConfigurationException
newTransformerHandler
in class SAXTransformerFactory
TransformerConfigurationException
public Transformer newTransformer(Source source) throws TransformerConfigurationException
newTransformer
in class TransformerFactory
source
- An object that holds a URL, input stream, etc.TransformerConfigurationException
- May throw this during the parse when it
is constructing the Templates object and fails.public Transformer newTransformer() throws TransformerConfigurationException
newTransformer
in class TransformerFactory
TransformerConfigurationException
- May throw this during
the parse when it is constructing the
Templates object and it fails.public Templates newTemplates(Source source) throws TransformerConfigurationException
newTemplates
in class TransformerFactory
source
- An object that holds a URL, input stream, etc.TransformerConfigurationException
- May throw this during the parse when it
is constructing the Templates object and fails.public void setURIResolver(URIResolver resolver)
setURIResolver
in class TransformerFactory
resolver
- An object that implements the URIResolver interface,
or null.public URIResolver getURIResolver()
getURIResolver
in class TransformerFactory
public ErrorListener getErrorListener()
getErrorListener
in class TransformerFactory
public void setErrorListener(ErrorListener listener) throws IllegalArgumentException
setErrorListener
in class TransformerFactory
listener
- Must be a non-null reference to an ErrorListener.IllegalArgumentException
- if the listener argument is null.public boolean isSecureProcessing()
Copyright © 2018 JBoss by Red Hat. All rights reserved.