Hello Georg,

here my way to store the SVG document:

Add this method to your own class (subclassing JSVGCanvas).

    public boolean saveDocument(String filename) {
           if (getSVGDocument() != null) {
                   SVGTranscoder transcoder = new SVGTranscoder();
                   transcoder.addTranscodingHint(SVGTranscoder.KEY_DOCTYPE, 
SVGTranscoder.VALUE_DOCTYPE_CHANGE);
                   OutputStream outputStream = null;
                   TranscoderInput input = new TranscoderInput(getSVGDocument());
                   try {
                           outputStream = new FileOutputStream(filename);
                   } catch (FileNotFoundException fnfe) {
                           fnfe.printStackTrace();
                   }
                   if (outputStream != null) {
                           TranscoderOutput output = new TranscoderOutput(new 
OutputStreamWriter(outputStream));
                           try {
                                   transcoder.transcode(input, output);
                           } catch (TranscoderException e) {
                                   e.printStackTrace();
                           }
                           try {
                                   outputStream.flush();
                                   outputStream.close();
                                   isDocumentChanged = false;
                           } catch (IOException e) {
                                   e.printStackTrace();
                           }
                   }
           }
           return !isDocumentChanged;
   }


isDocumentChanged is a member variable from my canvas class (subclassing JSVGCanvas)

This method is not perfect. If you store a file containing ecma script, than the ecma 
script will be damaged !
I try to improve the transcoder class to prevent this damage. I give you a message 
when I have solved this problem.

Jan

-----Ursprungliche Nachricht-----
Von: Georg A. [mailto:[EMAIL PROTECTED]
Gesendet: Mittwoch, 11. Juni 2003 15:50
An: Batik Users
Betreff: Re: AW: writeDocument link; my problem


I wrote it a few days ago and now copied it in the lower part of this 
mail, this are two mails
the first with the problen
the second with the link to the messed up document
I know that the whitespaces get killed during the streaming, but I 
don't know what I can do against that.

Georg

On Wednesday, Jun 11, 2003, at 15:39 Europe/Berlin, Lolling, Jan wrote:

> Sorry George, what is your problem ?
>
> Jan


mail 1:

Hi,

if I use
DOMUtilities.writeDocument(svgdoc,filewriter);
and the filewriter is defined as:
Writer filewriter = new OutputStreamWriter(file, "UTF-8");

my svgdoc is streamed but in a messed up form
what am I doing wrong?

Thanks

Georg

============
mail 2:

at http://www.ge-org.com/batik

you find a file SOV.svg, this is the messed up one
the worldcollapsed_jc.svg is the one how it should look like

cheers

Georg



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to