org.apache.xml.serializer
Interface Serializer
- SerializationHandler
- AdaptiveResultTreeImpl, EmptySerializer, SerializerBase, SimpleResultTreeImpl, StringValueHandler, ToHTMLSAXHandler, ToHTMLStream, ToSAXHandler, ToStream, ToTextSAXHandler, ToTextStream, ToUnknownStream, ToXMLSAXHandler, ToXMLStream
public interface Serializer
The Serializer interface is implemented by Serializers to publish methods to
get and set streams and writers, to set the output properties, and get the
Serializer as a ContentHandler or DOMSerializer.
asContentHandler
public ContentHandler asContentHandler()
throws IOException
Return a
ContentHandler
interface into this serializer.
If the serializer does not support the
ContentHandler
interface, it should return null.
- A
ContentHandler
interface into this serializer,
or null if the serializer is not SAX 2 capable
asDOMSerializer
public DOMSerializer asDOMSerializer()
throws IOException
Return a
DOMSerializer
interface into this serializer.
If the serializer does not support the
DOMSerializer
interface, it should return null.
- A
DOMSerializer
interface into this serializer,
or null if the serializer is not DOM capable
getOutputFormat
public Properties getOutputFormat()
Returns the output format properties for this serializer.
- The output format in use
getOutputStream
public OutputStream getOutputStream()
Get the output stream where the events will be serialized to.
- reference to the result stream, or null of only a writer was
set.
getWriter
public Writer getWriter()
Get the character stream where the events will be serialized to.
- Reference to the result Writer, or null.
reset
public boolean reset()
Resets the serializer. If this method returns true, the
serializer may be used for subsequent serialization of new
documents. It is possible to change the output format and
output stream prior to serializing, or to use the existing
output format and output stream.
- True if serializer has been reset and can be reused
setOutputFormat
public void setOutputFormat(Properties format)
Specifies an output format for this serializer. It the
serializer has already been associated with an output format,
it will switch to the new format. This method should not be
called while the serializer is in the process of serializing
a document.
format
- The output format to use
setOutputStream
public void setOutputStream(OutputStream output)
Specifies an output stream to which the document should be
serialized. This method should not be called while the
serializer is in the process of serializing a document.
The encoding specified in the output
Properties
is used, or
if no encoding was specified, the default for the selected
output method.
output
- The output stream
setWriter
public void setWriter(Writer writer)
Specifies a writer to which the document should be serialized.
This method should not be called while the serializer is in
the process of serializing a document.
The encoding specified for the output
Properties
must be
identical to the output format used with the writer.
writer
- The output writer stream
Copyright B) 2004 Apache XML Project. All Rights Reserved.