gpt4 book ai didi

xml - SVG Batik Root 元素命名空间与请求的不匹配

转载 作者:数据小太阳 更新时间:2023-10-29 01:48:32 26 4
gpt4 key购买 nike

几周前,它在我的 SVG 上运行得很好,但不知何故它停止了工作,我不知道原因,因为在服务器上触发的错误没有帮助。当我将 svg 文件传输到我的 pdf 时会发生这种情况:

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)

我不明白这是什么意思,我的 xml svg(在 xml 验证程序网站上)是有效代码。我是这样写的:

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>');

变量svgimage是一堆gdefstextimages等(真的很大,比如 1k 行)

最佳答案

我是这么建议的,但我没有完全理解这个问题 - 转换为 pdf 的过程在某个时候起作用,然后突然失败了。

在文档类型声明中:w3.org 提到在系统标识符中使用“平面”DTD,这是一个单一的平面 DTD,而不是多个文件。

w3.org - SVG NampeSpace, Public Identifier and System Identifier :

"Note that DTD listed in the System Identifier is a modularized DTD (i.e. its contents are spread over multiple files), which means that a validator may have to fetch the multiple modules in order to validate. For that reason, there is a single flattened DTD available that corresponds to the SVG 1.1 modularized DTD. It can be found at http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-flat.dtd."

关于xml - SVG Batik Root 元素命名空间与请求的不匹配,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37038459/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com