FileDocCategorySizeDatePackage
Serializer.javaAPI DocJava SE 5 API6195Fri Aug 26 14:56:02 BST 2005com.sun.org.apache.xml.internal.serialize

Serializer

public interface Serializer
Interface for a DOM serializer implementation, factory for DOM and SAX serializers, and static methods for serializing DOM documents.

To serialize a document using SAX events, create a compatible serializer and pass it around as a {@link org.xml.sax.DocumentHandler}. If an I/O error occurs while serializing, it will be thrown by {@link DocumentHandler#endDocument}. The SAX serializer may also be used as {@link org.xml.sax.DTDHandler}, {@link org.xml.sax.ext.DeclHandler} and {@link org.xml.sax.ext.LexicalHandler}.

To serialize a DOM document or DOM element, create a compatible serializer and call it's {@link DOMSerializer#serialize(Document)} or {@link DOMSerializer#serialize(Element)} methods. Both methods would produce a full XML document, to serizlie only the portion of the document use {@link OutputFormat#setOmitXMLDeclaration} and specify no document type.

The {@link OutputFormat} dictates what underlying serialized is used to serialize the document based on the specified method. If the output format or method are missing, the default is an XML serializer with UTF-8 encoding and now indentation.

version
$Revision: 1.13 $ $Date: 2003/05/13 13:23:49 $
author
Assaf Arkin
author
Scott Boag
see
DocumentHandler
see
ContentHandler
see
OutputFormat
see
DOMSerializer

Fields Summary
Constructors Summary
Methods Summary
public org.xml.sax.ContentHandlerasContentHandler()
Return a {@link ContentHandler} interface into this serializer. If the serializer does not support the {@link ContentHandler} interface, it should return null.

public com.sun.org.apache.xml.internal.serialize.DOMSerializerasDOMSerializer()
Return a {@link DOMSerializer} interface into this serializer. If the serializer does not support the {@link DOMSerializer} interface, it should return null.

public org.xml.sax.DocumentHandlerasDocumentHandler()
Return a {@link DocumentHandler} interface into this serializer. If the serializer does not support the {@link DocumentHandler} interface, it should return null.

public voidsetOutputByteStream(java.io.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.

public voidsetOutputCharStream(java.io.Writer output)
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.

public voidsetOutputFormat(com.sun.org.apache.xml.internal.serialize.OutputFormat 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.

param
format The output format to use