Title: Using GZipOutputStream with XMLSerializer
Hi Salim,
 
I used almost similar code many times and everything was OK. The only difference: I used SAX interfaces, instead of serializing DOM with XMLSerializer.serialize(Element). But it shouldn't make a difference.
If below is your exact code, I think you just need to close the stream in the end, at least it defenetely should be done to avoid data loss.
 
Thanks,
Dmitry
-----Original Message-----
From: Salim Erradey [mailto:[EMAIL PROTECTED]
Sent: Friday, November 16, 2001 13:23
To: [EMAIL PROTECTED]
Subject: Using GZipOutputStream with XMLSerializer

Hi,

I have an issue with the size of XML files my application is generating, so I decided to write to a compressed file. I have tried using the GZipOutputStream with the org.apache.xml.serialize.XMLSerializer:

       
        GZIPOutputStream gzipOS = new GZIPOutputStream(new FileOutputStream(new File("xml.gz")));
                XMLSerializer xmlSerializer = new XMLSerializer(gzipOS, outputFormat);
                xmlSerializer.asDOMSerializer();
        xmlSerializer.serialize(document.getDocumentElement());
}

I am getting an empty file with this. Do you know if it is possible ?, Has anyone tried this before ?. Feedback is greatly appreciated.

Best Regards,

Salim Erradey
e-mail: [EMAIL PROTECTED]

Reply via email to