I't not a design bug, it's a feature ;-)
Seriously, a serializer only needs to implement Serializer or
DocumentHandler. The default factory only deals with three specific
serializers, all of which extend BaseSerializer.
There should definitely be a way to use this factory with other
serializers. But you need to define a way to register and locate them
first. Somthing along:
void registerSerializerFactory( String method, SerializerFactory
factory );
or from a property file:
org.apache.xml.serialize.xml=<factory-class>
+1 for the rest of the interfaces you proposed.
arkin
Stefano Mazzocchi wrote:
>
> Hi,
>
> I found a design bug in the serialize classes. From Serializer.java the
> static methods are something like
>
> public static Serializer makeSerializer(OutputStream output,
> OutputFormat format )
> throws UnsupportedEncodingException
> {
> BaseSerializer serializer;
>
> serializer = makeBaseSerializer( format );
> serializer.init( output, format );
> return serializer;
> }
>
> This forces all Serializer implementations to extend BaseSerializer,
> which breaks the polymorphic behavior.
>
> This leads me to...
>
> propose to start discussing some XML Output API to propose an addiction
> to the proposed Sun's XML Java API that currently lack output features:
>
> interface Serializer() extends DocumentHandler {
>
> void setOutputFormat(OutputFormat);
> void setOutputByteStream(OutputStream output);
> void setOutputCharStream(Writer output);
>
> void serialize(Element elem) throws IOException;
> void serialize(Document doc) throws IOException;
> }
>
> class SerializerFactory() {
>
> Serializer makeSerializer(Writer writer, OutputFormat format);
> Serializer makeSerializer(OutputStream output, OutputFormat
> format) throws UnsupportedEncodingException;
>
> }
>
>
>
> --
> Stefano Mazzocchi One must still have chaos in oneself to be
> able to give birth to a dancing star.
> <[EMAIL PROTECTED]> Friedrich Nietzsche