BEA Systems, Inc.


weblogic.apache.xml.serialize
Interface Serializer

All Known Implementing Classes:
BaseMarkupSerializer

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 using #makeSAXSerializer and pass it around as a DocumentHandler. If an I/O error occurs while serializing, it will be thrown by DocumentHandler.endDocument(). The SAX serializer may also be used as DTDHandler, DeclHandler and LexicalHandler.

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

The convenience method #serialize(Document,Writer,OutputFormat) creates a serializer and calls #serizlie(Document) on that serialized.

The 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.

This class is based on an implementation from the Apache XML Project. In future releases the XML parser, XSLT processor, and associated classes will likely be updated to be based on a later version of the Apache implementations. Since Apache does not guarantee backwards compatibility between versions of their software, we cannot guarantee backwards compatibility of any of the classes contained in the weblogic.apache package or sub-packages.

Version:
$Revision: 1.9 $ $Date: 2000/08/30 18:59:21 $
Author:
Assaf Arkin, Scott Boag
See Also:
DocumentHandler, ContentHandler, OutputFormat, DOMSerializer

Method Summary
 org.xml.sax.ContentHandler asContentHandler()
          Return a ContentHandler interface into this serializer.
 org.xml.sax.DocumentHandler asDocumentHandler()
          Return a DocumentHandler interface into this serializer.
 DOMSerializer asDOMSerializer()
          Return a DOMSerializer interface into this serializer.
 void setOutputByteStream(java.io.OutputStream output)
          Specifies an output stream to which the document should be serialized.
 void setOutputCharStream(java.io.Writer output)
          Specifies a writer to which the document should be serialized.
 void setOutputFormat(OutputFormat format)
          Specifies an output format for this serializer.
 

Method Detail

setOutputByteStream

public void setOutputByteStream(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.

setOutputCharStream

public void setOutputCharStream(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.

setOutputFormat

public void setOutputFormat(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.

Parameters:
format - The output format to use

asDocumentHandler

public org.xml.sax.DocumentHandler asDocumentHandler()
                                              throws java.io.IOException
Return a DocumentHandler interface into this serializer. If the serializer does not support the DocumentHandler interface, it should return null.

asContentHandler

public org.xml.sax.ContentHandler asContentHandler()
                                            throws java.io.IOException
Return a ContentHandler interface into this serializer. If the serializer does not support the ContentHandler interface, it should return null.

asDOMSerializer

public DOMSerializer asDOMSerializer()
                              throws java.io.IOException
Return a DOMSerializer interface into this serializer. If the serializer does not support the DOMSerializer interface, it should return null.

Documentation is available at
http://download.oracle.com/docs/cd/E13222_01/wls/docs70

Copyright © 2004 BEA Systems, Inc. All Rights Reserved.
WebLogic Server 7.0 API Reference