In my application I simply used org.apache.batik.dom.util.DOMUtilities.writeDocument(SVGDocument, FileWriter); Michael Bishop
________________________________ From: julie gautier [mailto:[EMAIL PROTECTED] Sent: Thu 10/6/2005 7:52 AM To: [email protected] Subject: Write a svg document to a file Hi, I use Batik to create a svg document and display it on a window. For that I use the above code : public ActionForward doPerform(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { ... /*creation of the svg document */ DOMImplementation impl = SVGDOMImplementation.getDOMImplementation(); String svgNS = SVGDOMImplementation.SVG_NAMESPACE_URI; Document doc = impl.createDocument(svgNS, "svg", null); SVGGraphics2D svgGenerator = new SVGGraphics2D(doc); Element svgRoot = svgGenerator.getRoot(); /*insert svg into the document*/ ... /*send to output*/ java.io.OutputStream out = response.getOutputStream(); boolean useCSS = false; Writer wout = new OutputStreamWriter(out, "iso-8859-1"); svgGenerator.stream(svgRoot, wout); } This works fine. My problem is to send the "svgRoot" to a file on the server. Here is my code : BufferedWriter bw = new BufferedWriter(new FileWriter("c:\\test.svg")); svgGenerator.stream(svgRoot, bw); bw.close(); The document test.svg is created but when I try to open it I have an error : the first line is : "<?xml version="1.0"?>" instead of "<?xml version="1.0" encoding="iso-8859-1"?>" and I'm not able to open the file. What should I do ? Thanks in advance. Julie ________________________________ Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger Téléchargez le ici ! <http://us.rd.yahoo.com/messenger/mail_taglines/default/*http://fr.messenger.yahoo.com>
<<winmail.dat>>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
