Spec-Zone.ru › OpenJDK 27

Class SAXTransformerFactory

java.lang.Object
javax.xml.transform.TransformerFactory
javax.xml.transform.sax.SAXTransformerFactory
public abstract class SAXTransformerFactory extends TransformerFactory
This class extends TransformerFactory to provide SAX-specific factory methods. It provides two types of ContentHandlers, one for creating Transformers, the other for creating Templates objects.

If an application wants to set the ErrorHandler or EntityResolver for an XMLReader used during a transformation, it should use a URIResolver to return the SAXSource which provides (with getXMLReader) a reference to the XMLReader.

Since:
1.4

Field Summary

Modifier and Type Field Description
static final String FEATURE
If TransformerFactory.getFeature(String) returns true when passed this value as an argument, the TransformerFactory returned from TransformerFactory.newInstance() may be safely cast to a SAXTransformerFactory.
static final String FEATURE_XMLFILTER
If TransformerFactory.getFeature(String) returns true when passed this value as an argument, the newXMLFilter(Source src) and newXMLFilter(Templates templates) methods are supported.

Constructor Summary

SAXTransformerFactory()
Modifier Constructor Description
protected
The default constructor is protected on purpose.

Method Summary

Modifier and Type Method Description
abstract TemplatesHandler newTemplatesHandler()
Get a TemplatesHandler object that can process SAX ContentHandler events into a Templates object.
abstract TransformerHandler newTransformerHandler()
Get a TransformerHandler object that can process SAX ContentHandler events into a Result.
abstract 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.
abstract TransformerHandler newTransformerHandler(Templates templates)
Get a TransformerHandler object that can process SAX ContentHandler events into a Result, based on the Templates argument.
abstract XMLFilter newXMLFilter(Source src)
Create an XMLFilter that uses the given Source as the transformation instructions.
abstract XMLFilter newXMLFilter(Templates templates)
Create an XMLFilter, based on the Templates argument..

Methods declared in class TransformerFactory

getAssociatedStylesheet, getAttribute, getErrorListener, getFeature, getURIResolver, newDefaultInstance, newInstance, newInstance, newTemplates, newTransformer, newTransformer, setAttribute, setErrorListener, setFeature, setURIResolver
Modifier and Type Method Description
abstract Source getAssociatedStylesheet(Source source, String media, String title, String charset)
Get the stylesheet specification(s) associated with the XML Source document via the xml-stylesheet processing instruction that match the given criteria.
abstract Object getAttribute(String name)
Allows the user to retrieve specific attributes on the underlying implementation.
abstract ErrorListener getErrorListener()
Get the error event handler for the TransformerFactory.
abstract boolean getFeature(String name)
Look up the value of a feature.
abstract URIResolver getURIResolver()
Get the object that is used by default during the transformation to resolve URIs used in document(), xsl:import, or xsl:include.
static TransformerFactory newDefaultInstance()
Creates a new instance of the TransformerFactory builtin system-default implementation.
static TransformerFactory newInstance()
Obtains a new instance of a TransformerFactory.
static TransformerFactory newInstance(String factoryClassName, ClassLoader classLoader)
Obtain a new instance of a TransformerFactory from factory class name.
abstract Templates newTemplates(Source source)
Process the Source into a Templates object, which is a a compiled representation of the source.
abstract Transformer newTransformer()
Create a new Transformer that performs a copy of the Source to the Result, i.e. the "identity transform".
abstract Transformer newTransformer(Source source)
Process the Source into a Transformer Object.
abstract void setAttribute(String name, Object value)
Allows the user to set specific attributes on the underlying implementation.
abstract void setErrorListener(ErrorListener listener)
Set the error event listener for the TransformerFactory, which is used for the processing of transformation instructions, and not for the transformation itself.
abstract void setFeature(String name, boolean value)
Set a feature for this TransformerFactory and Transformers or Templates created by this factory.
abstract void setURIResolver(URIResolver resolver)
Set an object that is used by default during the transformation to resolve URIs used in document(), xsl:import, or xsl:include.

Methods declared in class Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Modifier and Type Method Description
protected Object clone()
Creates and returns a copy of this object.
boolean equals(Object obj)
Indicates whether some other object is "equal to" this one.
protected void finalize()
Deprecated, for removal: This API element is subject to removal in a future version.
Finalization is deprecated and subject to removal in a future release.
final Class<?> getClass()
Returns the runtime class of this Object.
int hashCode()
Returns a hash code value for this object.
final void notify()
Wakes up a single thread that is waiting on this object's monitor.
final void notifyAll()
Wakes up all threads that are waiting on this object's monitor.
String toString()
Returns a string representation of the object.
final void wait()
Causes the current thread to wait until it is awakened, typically by being notified or interrupted.
final void wait(long timeoutMillis)
Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.
final void wait(long timeoutMillis, int nanos)
Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

Field Details

FEATURE

public static final String FEATURE
If TransformerFactory.getFeature(String) returns true when passed this value as an argument, the TransformerFactory returned from TransformerFactory.newInstance() may be safely cast to a SAXTransformerFactory.
See Also:
  • Constant Field Values

FEATURE_XMLFILTER

public static final String FEATURE_XMLFILTER
If TransformerFactory.getFeature(String) returns true when passed this value as an argument, the newXMLFilter(Source src) and newXMLFilter(Templates templates) methods are supported.
See Also:
  • Constant Field Values

Constructor Details

SAXTransformerFactory

protected SAXTransformerFactory()
The default constructor is protected on purpose.

Method Details

newTransformerHandler

public abstract TransformerHandler newTransformerHandler(Source src) throws TransformerConfigurationException
Get a TransformerHandler object that can process SAX ContentHandler events into a Result, based on the transformation instructions specified by the argument.
Parameters:
src - The Source of the transformation instructions.
Returns:
TransformerHandler ready to transform SAX events.
Throws:
TransformerConfigurationException - If for some reason the TransformerHandler can not be created.

newTransformerHandler

public abstract TransformerHandler newTransformerHandler(Templates templates) throws TransformerConfigurationException
Get a TransformerHandler object that can process SAX ContentHandler events into a Result, based on the Templates argument.
Parameters:
templates - The compiled transformation instructions.
Returns:
TransformerHandler ready to transform SAX events.
Throws:
TransformerConfigurationException - If for some reason the TransformerHandler can not be created.

newTransformerHandler

public abstract TransformerHandler newTransformerHandler() throws TransformerConfigurationException
Get a TransformerHandler object that can process SAX ContentHandler events into a Result. The transformation is defined as an identity (or copy) transformation, for example to copy a series of SAX parse events into a DOM tree.
Returns:
A non-null reference to a TransformerHandler, that may be used as a ContentHandler for SAX parse events.
Throws:
TransformerConfigurationException - If for some reason the TransformerHandler cannot be created.

newTemplatesHandler

public abstract TemplatesHandler newTemplatesHandler() throws TransformerConfigurationException
Get a TemplatesHandler object that can process SAX ContentHandler events into a Templates object.
Returns:
A non-null reference to a TransformerHandler, that may be used as a ContentHandler for SAX parse events.
Throws:
TransformerConfigurationException - If for some reason the TemplatesHandler cannot be created.

newXMLFilter

public abstract XMLFilter newXMLFilter(Source src) throws TransformerConfigurationException
Create an XMLFilter that uses the given Source as the transformation instructions.
Parameters:
src - The Source of the transformation instructions.
Returns:
An XMLFilter object, or null if this feature is not supported.
Throws:
TransformerConfigurationException - If for some reason the TemplatesHandler cannot be created.

newXMLFilter

public abstract XMLFilter newXMLFilter(Templates templates) throws TransformerConfigurationException
Create an XMLFilter, based on the Templates argument..
Parameters:
templates - The compiled transformation instructions.
Returns:
An XMLFilter object, or null if this feature is not supported.
Throws:
TransformerConfigurationException - If for some reason the TemplatesHandler cannot be created.

Report a bug or suggest an enhancement
For further API reference and developer documentation see the Java SE Documentation, which contains more detailed, developer-targeted descriptions with conceptual overviews, definitions of terms, workarounds, and working code examples. Other versions.
Java is a trademark or registered trademark of Oracle and/or its affiliates in the US and other countries.
Copyright © 1993, 2026, Oracle and/or its affiliates, 500 Oracle Parkway, Redwood Shores, CA 94065 USA.
All rights reserved. Use is subject to license terms and the documentation redistribution policy.

© 1993, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API