The problem you are running into is because the xml:space attribute is written twice on the <style> element. This is a bug in the PrettyPrinter but I thought it had been fixed. Are you using 1.5 beta 4b? Did you try with the current CVS version?
Vincent.
Sebastian Hagen wrote:
Hello, I am using Batik Pretty Printer for formated SVG Output.First I create a SVGDocument from the following Code: <?xml version="1.0"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd"> <svg width="500" height="500"> <line x1="75" y1="285" x2="152" y2="228" style="fill:none;stroke:rgb(149,91,91);stroke-width:2"/> <style type="text/css"><![CDATA[path {fill-rule:nonzero; stroke-linecap:round; stroke-linejoin:round} rect {stroke-linejoin:miter}]]></style> </svg> Note that there is a CDATA Section within the code. When I now use PrettyPrinter, I get the following result: Please don�t worry about, if the CDATA section makes sense within this code. <svg contentScriptType="text/ecmascript" width="500" xmlns:xlink="http://www.w3.org/1999/xlink" zoomAndPan="magnify" contentStyleType="text/css" height="500" preserveAspectRatio="xMidYMid meet" xmlns="http://www.w3.org/2000/svg" version="1.0"> <style xml:space="preserve" type="text/css" xml:space="preserve"><![CDATA[path {fill-rule:nonzero; stroke-linecap:round; stroke-linejoin:round}]]><![CDATA[ ]]><![CDATA[ rect {stroke-linejoin:miter}]]></style> <line y2="228.0" style="fill: none; stroke: rgb(149, 91, 91); stroke-width: 2; " x1="75.0" x2="152.0" y1="285.0"/> </svg> This code is not well formed anymore. Adobe SVG Viewer says: Double attribute in line 7 My question now is: where do all those CDATA Tags come from. Below there is a Java code, that shows how I am using the PrettyPrinter. Is this a bug of PrettyPrinter, or did I do something wrong in my code. Thanks, Sebastian public static void writeToFile( SVGDocument in_SVGDocument, String fileName ) { Reader r; Writer w = null; File objFile = new File( fileName ); try { w = new FileWriter(objFile.getPath()); } catch (IOException ex) { } PrettyPrinter objPrettyPrinter = new PrettyPrinter(); objPrettyPrinter.setFormat(true); StringWriter sw = new StringWriter(); try { DOMUtilities.writeDocument(in_SVGDocument, sw); } catch (IOException ex) { } r = new StringReader(sw.toString()); try { objPrettyPrinter.print(r, w); } catch (TranscoderException ex) { }catch (IOException ex) { } try { w.flush(); w.close(); } catch (IOException ex) { } } --------------------------------------------------------------------- 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]
