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


Reply via email to