From: Jeremias Maerki Date: Fri, 15 Aug 2008 14:17:52 +0000 (+0000) Subject: Some fixes for SVG along the way: X-Git-Tag: fop-1_0~115^2~142 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=18c9e7a523a4c8b186e2884a4466ece3791b4e34;p=xmlgraphics-fop.git Some fixes for SVG along the way: Fix for group nesting. Fix for reused content (metadata etc.) cause exceptions. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign@686227 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/sandbox/org/apache/fop/render/svg/AbstractSVGPainter.java b/src/sandbox/org/apache/fop/render/svg/AbstractSVGPainter.java index a7ce20c51..e32b9f937 100644 --- a/src/sandbox/org/apache/fop/render/svg/AbstractSVGPainter.java +++ b/src/sandbox/org/apache/fop/render/svg/AbstractSVGPainter.java @@ -193,6 +193,7 @@ public abstract class AbstractSVGPainter extends AbstractXMLWritingIFPainter /** {@inheritDoc} */ public void endGroup() throws IFException { try { + establish(MODE_NORMAL); endElement("g"); } catch (SAXException e) { throw new IFException("SAX error in endGroup()", e); diff --git a/src/sandbox/org/apache/fop/render/svg/SVGPainter.java b/src/sandbox/org/apache/fop/render/svg/SVGPainter.java index 7f92de7ed..aa52673a9 100644 --- a/src/sandbox/org/apache/fop/render/svg/SVGPainter.java +++ b/src/sandbox/org/apache/fop/render/svg/SVGPainter.java @@ -109,6 +109,9 @@ public class SVGPainter extends AbstractSVGPainter { TransformerHandler toDOMHandler = tFactory.newTransformerHandler(); toDOMHandler.setResult(new DOMResult(this.reusedParts)); this.handler = toDOMHandler; + this.handler.startDocument(); + } catch (SAXException se) { + throw new IFException("SAX error in startDocument()", se); } catch (TransformerConfigurationException e) { throw new IFException( "Error while setting up a TransformerHandler for SVG generation", e); @@ -120,6 +123,18 @@ public class SVGPainter extends AbstractSVGPainter { //nop } + /** {@inheritDoc} */ + public void endDocumentHeader() throws IFException { + super.endDocumentHeader(); + try { + //Stop recording parts reused for each page + this.handler.endDocument(); + this.handler = null; + } catch (SAXException e) { + throw new IFException("SAX error in endDocumentHeader()", e); + } + } + /** {@inheritDoc} */ public void startPageSequence(String id) throws IFException { //nop