Hello.
Simple problem: How do I make a String from Document? (I'm using the
xalan-j_2_5_1 distribution)
My suggestion:

----------
        Serializer ser = null;
        ByteArrayOutputStream os  = new ByteArrayOutputStream();
        WriterToUTF8Buffered writer = null;
        DOMSerializer domser = null;
        Properties props = null;

        try{
                writer = new WriterToUTF8Buffered(os);
                props =
OutputPropertiesFactory.getDefaultMethodProperties(Method.TEXT);
                ser = SerializerFactory.getSerializer(props);
                ser.setWriter(writer);
                domser = (DOMSerializer) ser.asDOMSerializer();
                domser.serialize(doc);
                writer.close();
                return os.toString();
     }catch(...
-----------

This works if I use Method.XML - but this adds the standard XML starttagline
in my document (and I don't want that), that's why I use Method.TEXT.
Problem is: Nothing is written, only empty String with the right
size...There is something here I have missed, isn't it?

Johannes

Reply via email to