SVG Batik root directory element namespace does not match requested

A few weeks ago, he worked PERFECTLY with my SVG, but for some reason it stopped working, and I don’t know the reason, because the error running on the server did not help. This happens when I transfer the svg file to the pdf file:

Root element namespace does not match that requested: Requested: http://www.w3.org/2000/svg Found: null. Stacktrace follows: org.apache.batik.bridge.BridgeException: Root element namespace does not match that requested: Requested: http://www.w3.org/2000/svg Found: null at org.apache.batik.bridge.BridgeContext.getReferencedNode(BridgeContext.java:780) at org.apache.batik.bridge.BridgeContext.getReferencedElement(BridgeContext.java:796) at org.apache.batik.bridge.CSSUtilities.convertClipPath(CSSUtilities.java:719) at org.apache.batik.bridge.AbstractGraphicsNodeBridge.buildGraphicsNode(AbstractGraphicsNodeBridge.java:146) at org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(GVTBuilder.java:224) at org.apache.batik.bridge.GVTBuilder.buildComposite(GVTBuilder.java:171) at org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(GVTBuilder.java:219) at org.apache.batik.bridge.GVTBuilder.buildComposite(GVTBuilder.java:171) at org.apache.batik.bridge.GVTBuilder.build(GVTBuilder.java:82) at net.sf.jasperreports.renderers.BatikRenderer.ensureSvg(BatikRenderer.java:192) at net.sf.jasperreports.renderers.BatikRenderer.getDimension(BatikRenderer.java:141) at net.sf.jasperreports.engine.export.JRPdfExporter.exportImage(JRPdfExporter.java:1351) at net.sf.jasperreports.engine.export.JRPdfExporter.exportElements(JRPdfExporter.java:774) at net.sf.jasperreports.engine.export.JRPdfExporter.exportPage(JRPdfExporter.java:738) at net.sf.jasperreports.engine.export.JRPdfExporter.exportReportToStream(JRPdfExporter.java:616) at net.sf.jasperreports.engine.export.JRPdfExporter.exportReport(JRPdfExporter.java:364) at com.scacp.operation.MonitoringWellController$_closure13.doCall(MonitoringWellController.groovy:749) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) 

I don't know what this means, my xml svg (on the XML validation website) is valid code. I write like this:

 file.write('<?xml version="1.0" encoding="UTF-8"?> \n' + '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> \n' + '<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="705px" height="1000px" viewBox="0 0 705 1000" enable-background="new 0 0 705 1000" xml:space="preserve"> \n' + svgimage + '\n' + '</svg>'); 

The svgimage variable is a collection of g , defs , text , images , etc. (really big, e.g. 1k lines)

+7
xml jasper-reports svg
source share
2 answers

I had a lot of work to find the reason for + 1k lines on my xml and this is the tag that was created by svg and w3 is not recognized, which is clipPath and clip-path , and deleting them works fine:

 <clipPath id="_ABSTRACT_RENDERER_ID_0"> //removed ... </clipPath> <g clip-path="url(http://mypage.com/344#_ABSTRACT_RENDERER_ID_0)"> //remove the attribute clip-path ... </g> 

Somehow w3 did not recognize url(...) , just deleting it, it works. And this is strange; it has always been there.

0
source share

I suggest this, but I do not fully understand the problem - at some point I switched to work in PDF, and then suddenly crashed.

In the document type declaration: w3.org mentions the use of a β€œflat” DTD in the system identifier, which is one flattened DTD and not multiple files.

w3.org - SVG NampeSpace, public identifier and system identifier:

β€œPlease note that the DTD specified in System Identifier is a modular DTD (that is, its contents are distributed across several files), which means that the validator may need to select several modules for verification. For this reason, there is one flattened DTD that corresponds to DTD SVG 1.1 module. It can be found at http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-flat.dtd . "

0
source share

All Articles