org.apache.xml.serialize
public interface Serializer
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.14 $ $Date: 2004/02/24 23:34:03 $
See Also: DocumentHandler ContentHandler OutputFormat DOMSerializer
Method Summary | |
---|---|
ContentHandler | asContentHandler()
Return a {@link ContentHandler} interface into this serializer.
|
DocumentHandler | asDocumentHandler()
Return a {@link DocumentHandler} interface into this serializer.
|
DOMSerializer | asDOMSerializer()
Return a {@link DOMSerializer} interface into this serializer.
|
void | setOutputByteStream(OutputStream output)
Specifies an output stream to which the document should be
serialized. |
void | setOutputCharStream(Writer output)
Specifies a writer to which the document should be serialized.
|
void | setOutputFormat(OutputFormat format)
Specifies an output format for this serializer. |
Parameters: format The output format to use