]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Some fixes for SVG along the way:
authorJeremias Maerki <jeremias@apache.org>
Fri, 15 Aug 2008 14:17:52 +0000 (14:17 +0000)
committerJeremias Maerki <jeremias@apache.org>
Fri, 15 Aug 2008 14:17:52 +0000 (14:17 +0000)
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

src/sandbox/org/apache/fop/render/svg/AbstractSVGPainter.java
src/sandbox/org/apache/fop/render/svg/SVGPainter.java

index a7ce20c51957cc69f2edea24081e37167370b15a..e32b9f93705c2ffc5ab96aafbd7d0883368e1f9d 100644 (file)
@@ -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);
index 7f92de7ed8d1a2739ebfed3736d4adabc3f53507..aa52673a9de1ee4d60077098fcadecdce8fe4c6e 100644 (file)
@@ -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