APIdia Launch Partner
Top Description Constructors Methods
com.sun.org.apache.xml.internal.serializer

public final Class SerializerFactory

extends Object
Class Inheritance
Imports
com.sun.org.apache.xalan.internal.utils.ObjectFactory, com.sun.org.apache.xml.internal.serializer.utils.MsgKey, .Utils, java.util.Properties, javax.xml.transform.OutputKeys, org.xml.sax.ContentHandler

This class is a public API, it is a factory for creating serializers. The properties object passed to the getSerializer() method should be created by the OutputPropertiesFactory. Although the properties object used to create a serializer does not need to be obtained from OutputPropertiesFactory, using this factory ensures that the default key/value properties are set for the given output "method".

The standard property keys supported are: "method", "version", "encoding", "omit-xml-declaration", "standalone", doctype-public", "doctype-system", "cdata-section-elements", "indent", "media-type". These property keys and their values are described in the XSLT recommendation, see href="http://www.w3.org/TR/1999/REC-xslt-19991116"> XSLT 1.0 recommendation</a>

The value of the "cdata-section-elements" property key is a whitespace separated list of elements. If the element is in a namespace then value is passed in this format: {uri}localName

The non-standard property keys supported are defined in OutputPropertiesFactory.

See Also
OutputPropertiesFactory, Method, Serializer

Constructor Summary

AccessConstructor and Description
private
SerializerFactory()

This constructor is private just to prevent the creation of such an object.

Method Summary

Modifier and TypeMethod and Description
public static Serializer

Returns:

A suitable serializer.
getSerializer
(Properties
The output format, minimally the "method" property must be set.
format
)

Returns a serializer for the specified output method.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

SerializerFactoryback to summary
private SerializerFactory()

This constructor is private just to prevent the creation of such an object.

Method Detail

getSerializerback to summary
public static Serializer getSerializer(Properties format)

Returns a serializer for the specified output method. The output method is specified by the value of the property associated with the "method" key. If no implementation exists that supports the specified output method an exception of some type will be thrown. For a list of the output "method" key values see Method.

Parameters
format:Properties

The output format, minimally the "method" property must be set.

Returns:Serializer

A suitable serializer.

Exceptions
IllegalArgumentException:
if method is null or an appropriate serializer can't be found
Exception:
if the class for the serializer is found but does not implement ContentHandler.
WrappedRuntimeException:
if an exception is thrown while trying to find serializer