>From your original post, it looks like you're using the SVGGraphics2D to >create document fragments. That approach doesn't work well in that the >SVGGraphics2D object doesn't render anything to your document. I ran into >that problem myself. You did say you appended everything to your SVG root >element though. The empty file does sound problematic of using the >SVGGraphics2D object and expecting to have elements in your document that may >not be there. How are you adding things? You may want to look up a quick >routine to print DOM documents to the screen so you can see what the DOM tree >actually represents. Michael Bishop
________________________________ From: julie gautier [mailto:[EMAIL PROTECTED] Sent: Thu 10/6/2005 10:09 AM To: [email protected] Subject: RE: Write a svg document to a file Thanks for your answer. I tried your suggestion : I wrote : org.apache.batik.dom.util.DOMUtilities.writeDocument(doc, new FileWriter("c:\\test.svg")); where doc is the Document described in the example below. But it doesn't work : the svg file created is empty. Do you know why ? As I created the svg document by appending everything to the svgRoot element, I also tried as follow : org.apache.batik.dom.util.DOMUtilities.writeDocument(svgRoot.getOwnerDocument(), new FileWriter("c:\\test.svg")); but it failed too. Do you know what to do ? Thanks again. Julie "Bishop, Michael W. CONTR J9C880" <[EMAIL PROTECTED]> a écrit : 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 = ne w 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 : "" instead of "" 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 Y ahoo! Messenger Téléchargez le ici ! --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ________________________________ 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]
