如何在svg文件中使用xml标签

时间:2022-11-20 20:56:53

I have a next svg code

我有一个下一个svg代码

<?xml version="1.0" standalone="no"?>
<svg width="100" height="100" version="1.1"
     baseProfile="full"
     xmlns="http://www.w3.org/2000/svg" 
     xmlns:mpc="http://www.w3.org/1999/xhtml">
     <mpc:signal pairid='8943'></mpc:signal>
     <text x='10' y='10'>12332</text>
 </svg>

But this code is not valid on http://validator.w3.org/.

但是此代码在http://validator.w3.org/上无效。

What could be the problem?

可能是什么问题呢?

Update code

<?xml version="1.0" standalone="no"?>
<svg width="100" height="100" version="1.1"
     baseProfile="full"
     xmlns="http://www.w3.org/2000/svg" xmlns:mpc="http://www.crtc.com/mpclogic">
     <defs>
         <mpc:signal pairid='8943'></mpc:signal>
     </defs>
  <text x='10' y='10'>12332</text>
</svg>

But this code still returns next error - Line 6, Column 31: Element signal from namespace http://www.crtc.com/mpclogic not allowed as child of SVG element defs in this context. (Suppressing further errors from this subtree.)

但是这段代码仍然会返回下一个错误 - 第6行,第31列:来自命名空间http://www.crtc.com/mpclogic的元素信号不允许作为SVG元素的子元素在此上下文中定义。 (抑制此子树中的更多错误。)

1 个解决方案

#1


0  

xmlns:mpc="http://www.w3.org/1999/xhtml" says that you wish to use mpc as the prefix for the html namespace but <signal> is not an html tag. I suspect you want something other than http://www.w3.org/1999/xhtml here.

xmlns:mpc =“http://www.w3.org/1999/xhtml”表示您希望使用mpc作为html命名空间的前缀,但 不是html标记。我怀疑你想要的东西不是http://www.w3.org/1999/xhtml。

#1


0  

xmlns:mpc="http://www.w3.org/1999/xhtml" says that you wish to use mpc as the prefix for the html namespace but <signal> is not an html tag. I suspect you want something other than http://www.w3.org/1999/xhtml here.

xmlns:mpc =“http://www.w3.org/1999/xhtml”表示您希望使用mpc作为html命名空间的前缀,但 不是html标记。我怀疑你想要的东西不是http://www.w3.org/1999/xhtml。