第26行第39行的错误:未定义脚本上href的命名空间前缀xlink [英] error on line 39 at column 26: Namespace prefix xlink for href on script is not defined

查看:401
本文介绍了第26行第39行的错误:未定义脚本上href的命名空间前缀xlink的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在这样的svg文件中嵌入了一个javascript文件:

i am embedding a javascript file inside an svg file like this:

<svg 
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:cc="http://creativecommons.org/ns#"
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:svg="http://www.w3.org/2000/svg"
   xmlns="http://www.w3.org/2000/svg"
   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
   version="1.0"
   width="958.69"
   height="592.78998"
   id="svg2275"
   sodipodi:version="0.32"
   inkscape:version="0.46"
   sodipodi:docname="Map of USA with state names.svg"
   sodipodi:docbase="C:\temp\webdesign"
   inkscape:output_extension="org.inkscape.output.svg.inkscape"> 
  <metadata 
     id="metadata2625"> 
    <rdf:RDF> 
      <cc:Work 
         rdf:about=""> 
        <dc:format>image/svg+xml</dc:format> 
        <dc:type 
           rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> 
      </cc:Work> 
    </rdf:RDF> 
  </metadata> 
  <defs 
     id="defs2623"> 
    <inkscape:perspective 
       sodipodi:type="inkscape:persp3d"
       inkscape:vp_x="0 : 296.39499 : 1"
       inkscape:vp_y="0 : 1000 : 0"
       inkscape:vp_z="958.69 : 296.39499 : 1"
       inkscape:persp3d-origin="479.345 : 197.59666 : 1"
       id="perspective364" /> 
  </defs> 
  <script type="text/ecmascript" xlink:href="script.js" />
...
.........
.....
......

我得到了上述错误。

推荐答案

您从未定义过xlink命名空间(就像错误所告诉的)

You never defined the xlink namespace (just like the error tells you)

您需要做一些类似于sodipodi命名空间的操作:

You'll need to do something like what was done for the sodipodi namespace:

xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"

根据W3C,相应的命名空间声明是:

According to the W3C, the appropriate namespace declaration is:

xmlns:xlink="http://www.w3.org/1999/xlink"

将它添加到根元素。

这篇关于第26行第39行的错误:未定义脚本上href的命名空间前缀xlink的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆