2013-08-23 40 views
0

如何使用XML标签我有一个未来的SVG代码在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> 

但这代码无效的http://validator.w3.org/

可能是什么问题?

更新代码

<?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> 

但这个代码仍然会返回一个错误 - 6号线,第31列:从不允许在此背景下SVG元素DEFS的孩子命名空间http://www.crtc.com/mpclogic元信号。 (抑制来自该子树的进一步错误)

回答

0

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

+0

- 它是XML标记。 XML的命名空间 - [http://www.w3.org/1999/xml](http://www.w3.org/1999/xml)? –

+0

有没有这样的事情作为XML命名空间 –

+0

非常感谢。比我怎么可以在svg中使用xml标签? –