以文本方式查看主题

-  中文XML论坛 - 专业的XML技术讨论区  (http://bbs.xml.org.cn/index.asp)
--  『 SVG/GML/VRML/X3D/XAML 』  (http://bbs.xml.org.cn/list.asp?boardid=21)
----  [求助]用MSXML解析SVG的两个问题  (http://bbs.xml.org.cn/dispbbs.asp?boardid=21&rootid=&id=42812)


--  作者:unicornwhy
--  发布时间:1/26/2007 5:33:00 PM

--  [求助]用MSXML解析SVG的两个问题
我用的是MSXML4.0,对SVG没什么了解,公司项目需要,没想到一动手就遇到问题

1.有Link的文件不能加载,就是load(filename)的时候就出错
    我在SVG文件里加了下面一句
<a xlink:href="http://www.w3.org//Graphics//SVG//Overview.htm8">
   就解析不了了,删除后正常解析

2.doctype解析不正常
   只要SVG文件里有doctype语句,就会解析完这句后退出
比如我的SVG文件如下:
<?xml version="1.0" standalone="no" ?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">

<svg width="300" height="100" xmlns="http://www.w3.org/2000/svg">

<rect x="25" y="10" width="280" height="50"
fill="red" stroke="blue" stroke-width="3"/>

</svg>

则解析的结果
the NO.0 Attributes version of xml is  = 1.0
the NO.1 Attributes standalone of xml is  = no
the NO.0 Attributes PUBLIC of svg is  = -//W3C//DTD SVG 1.0//EN
the NO.1 Attributes SYSTEM of svg is  = http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd

删除doctype语句后解析结果为:
the NO.0 Attributes version of xml is  = 1.0
the NO.1 Attributes standalone of xml is  = no
the NO.0 Attributes width of svg is  = 300
the NO.1 Attributes height of svg is  = 100
the NO.2 Attributes xmlns of svg is  = http://www.w3.org/2000/svg
the NO.0 Attributes x of rect is  = 25
the NO.1 Attributes y of rect is  = 10
the NO.2 Attributes width of rect is  = 280
the NO.3 Attributes height of rect is  = 50
the NO.4 Attributes fill of rect is  = red
the NO.5 Attributes stroke of rect is  = blue
the NO.6 Attributes stroke-width of rect is  = 3


W 3 C h i n a ( since 2003 ) 旗 下 站 点
苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
31.250ms