You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by "Georg A." <at...@eva.mpg.de> on 2003/03/19 19:21:16 UTC

RE: Stream SVGDocument

Hi Vincent,

thanks for your quick answer, I solved the problem.
No I have another little problem.
--------
  public void streamsvg(){
       try
       {

         filename = 
mydb.getLanguageName(mydb.getSelectedLanguage())+".svg";
         boolean useCSS = true;
         Writer console = new OutputStreamWriter(System.out, "UTF-8");
         Writer file = new FileWriter(filename);
         root = svgdoc.getDocumentElement();
         // writes the files out
         out.getRoot(root);
         out.stream(root, console, true);
         System.out.println("written");

         out.stream(root, file, true);
         System.out.println("file written");
       }
         catch(Exception ex){}

       }
-----

I use a FileWriter to stream into a file, is there a chance to tell the 
FileWriter to encode in "UTF-8", like for the standard output, 
otherwise it uses "Mac-Roman"
and Adobe Illustrator can't read that

thanks a lot

Georg


 >Hello Georg,
 >
 >After you used the getRoot method, the 'content' of the SVGGraphics2D
 >has been moved over to your doc2's document element and is no longer
 >contained in the SVGGraphics2D internal DOM structures.
 >
 >What you could do is stream method on SVGGraphics2D that takes an
 >Element parameter and pass your doc2's document element.
 >
 >Vincent.
-- 



Georg Apitz

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
WALS Project
Executive Programmer

Max Planck Institute for Evolutionary Anthropology
Inselstrasse 22
04103 Leipzig
Germany
Phone: +49 (0) 341 99 52 - 257
Telefax: +49 (0)341 99 52 - 119

georg@apitz.de
www.eva.mpg.de
www.ge-org.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


--
########################################
georg@apitz.de
www.ge-org.com

Unser Leben ist das, wozu es unser Denken macht.
########################################


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


Re: Stream SVGDocument

Posted by Vincent Hardy <vi...@sun.com>.
Hi Georg,

Georg A. wrote:
> Hi Vincent,
> 
> thanks for your quick answer, I solved the problem.
> No I have another little problem.
> --------
>  public void streamsvg(){
>       try
>       {
> 
>         filename = mydb.getLanguageName(mydb.getSelectedLanguage())+".svg";
>         boolean useCSS = true;
>         Writer console = new OutputStreamWriter(System.out, "UTF-8");
>         Writer file = new FileWriter(filename);
>         root = svgdoc.getDocumentElement();
>         // writes the files out
>         out.getRoot(root);
>         out.stream(root, console, true);
>         System.out.println("written");
> 
>         out.stream(root, file, true);
>         System.out.println("file written");
>       }
>         catch(Exception ex){}
> 
>       }
> -----
> 
> I use a FileWriter to stream into a file, is there a chance to tell the 
> FileWriter to encode in "UTF-8", like for the standard output, otherwise 
> it uses "Mac-Roman"
> and Adobe Illustrator can't read that
> 

I would do what the FileWriter documentation says:

"FileWriter:

Convenience class for writing character files. The constructors of this 
class assume that the default character encoding and the default 
byte-buffer size are acceptable. To specify these values yourself, 
construct an OutputStreamWriter on a FileOutputStream. "

Vincent.


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org