The serializer must be initialized with the proper writer and output format before it can be used by calling {@link #setOutputCharStream} or {@link #setOutputByteStream} for the writer and {@link #setOutputFormat}for the output format.
The serializer can be reused any number of times, but cannot be used concurrently by two threads.
If an output stream is used, the encoding is taken from the output format (defaults to UTF-8). If a writer is used, make sure the writer uses the same encoding (if applies) as specified in the output format.
The serializer supports both DOM and SAX. DOM serializing is done by calling {@link #serialize(Document)} and SAX serializing is done by firingSAX events and using the serializer as a document handler. This also applies to derived class.
If an I/O exception occurs while serializing, the serializer will not throw an exception directly, but only throw it at the end of serializing (either DOM or SAX's {@link org.xml.sax.DocumentHandler#endDocument}.
For elements that are not specified as whitespace preserving, the serializer will potentially break long text lines at space boundaries, indent lines, and serialize elements on separate lines. Line terminators will be regarded as spaces, and spaces at beginning of line will be stripped.
When indenting, the serializer is capable of detecting seemingly element content, and serializing these elements indented on separate lines. An element is serialized indented when it is the first or last child of an element, or immediate following or preceding another element. @version $Revision: 1.46 $ $Date: 2003/07/30 11:14:08 $ @author Assaf Arkin @author Rahul Srivastava @author Elena Litani, IBM @see Serializer @see DOMSerializer
|
|
|
|