加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

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

发布时间:2020-12-16 07:45:40 所属栏目:百科 来源:网络整理
导读:几个星期前,它完全正常工作我的SVG,但它不知何故停止工作,我不知道原因,因为在服务器上发出的错误没有帮助.当我将svg文件传输到我的pdf时会发生这种情况: Root element namespace does not match that requested:Requested: http://www.w3.org/2000/svgFoun
几个星期前,它完全正常工作我的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是一堆g,defs,文本,图像等(非常大,像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 07001.”

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读