[ https://issues.apache.org/jira/browse/FOP-2490?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Luis Bernardo resolved FOP-2490. -------------------------------- Resolution: Fixed Fix Version/s: trunk Fix applied in http://svn.apache.org/viewvc?view=revision&revision=1687458. > Embedded SVG 1.2 not supported by FOP 2.0 > ----------------------------------------- > > Key: FOP-2490 > URL: https://issues.apache.org/jira/browse/FOP-2490 > Project: FOP > Issue Type: Bug > Affects Versions: 2.0 > Environment: Linux, Java 1.6 64-bit (not relevant) > Reporter: Hussein Shafie > Fix For: trunk > > Attachments: EXPECTED__doc.pdf, __doc.fo > > > h4. Embedded SVG 1.2 not supported by FOP 2.0 > How to reproduce the problem (see attached files) > fop -fo __doc.fo -pdf __doc.pdf > Running this command fails with: > {noformat} > org.w3c.dom.DOMException: The current document is unable to create an element > of the requested type (namespace: http://www.w3.org/2000/svg, name: > svg:flowRoot). > at org.apache.batik.dom.AbstractNode.createDOMException(Unknown > Source) > at > org.apache.batik.anim.dom.SVGDOMImplementation.createElementNS(Unknown Source) > at org.apache.batik.anim.dom.SVGOMDocument.createElementNS(Unknown > Source) > at org.apache.xml.utils.DOMBuilder.startElement(DOMBuilder.java:324) > at > org.apache.xalan.transformer.TransformerIdentityImpl.startElement(TransformerIdentityImpl.java:1072) > at > org.apache.fop.util.DelegatingContentHandler.startElement(DelegatingContentHandler.java:185) > at > org.apache.fop.fo.extensions.svg.SVGDOMContentHandlerFactory$Handler.startElement(SVGDOMContentHandlerFactory.java:137) > at > org.apache.fop.fo.FOTreeBuilder.startElement(FOTreeBuilder.java:179) > at > org.apache.xalan.transformer.TransformerIdentityImpl.startElement(TransformerIdentityImpl.java:1072) > {noformat} > The expected result is EXPECTED__doc.pdf > My workaround: > In org/apache/fop/fo/extensions/svg/SVGDOMContentHandlerFactory.java, > I've replaced: > {noformat} > private DOMImplementation getDOMImplementation(String ver) { > //TODO It would be great if Batik provided this method as static > helper method. > if (ver == null || ver.length() == 0 > || ver.equals("1.0") || ver.equals("1.1")) { > return SVGDOMImplementation.getDOMImplementation(); > } else if (ver.equals("1.2")) { > try { > Class clazz = Class.forName( > > "org.apache.batik.dom.svg12.SVG12DOMImplementation"); > return (DOMImplementation)clazz.getMethod( > "getDOMImplementation", > (Class[])null).invoke(null, (Object[])null); > } catch (Exception e) { > return SVGDOMImplementation.getDOMImplementation(); > } > } > throw new RuntimeException("Unsupport SVG version '" + ver + "'"); > } > {noformat} > by: > {noformat} > import org.apache.batik.anim.dom.SVG12DOMImplementation; > private DOMImplementation getDOMImplementation(String ver) { > //TODO It would be great if Batik provided this method as static > helper method. > if (ver == null || ver.length() == 0 > || ver.equals("1.0") || ver.equals("1.1")) { > return SVGDOMImplementation.getDOMImplementation(); > } else if (ver.equals("1.2")) { > return SVG12DOMImplementation.getDOMImplementation(); > } > throw new RuntimeException("Unsupport SVG version '" + ver + "'"); > } > {noformat} > org.apache.batik.anim.dom.SVG12DOMImplementation is always > included in Batik-1.8-all.jar. Even if you prefer to keep Class.forName(), > please note that org.apache.batik.dom.svg12.SVG12DOMImplementation > no longer exists in Batik 1.8. -- This message was sent by Atlassian JIRA (v6.3.4#6332)