简体   繁体   English

ActionScript 3 SVG XML解析错误?

[英]Actionscript 3 svg XML parsing bug?

Hey I get two different results when using the for each loop below. 嘿,在下面的每个循环中使用时,我得到两个不同的结果。

As far as I can tell there's no difference aside from attributes in the two XML literals. 据我所知,除了两个XML文字中的属性外,没有什么区别。

for each (var pathXML:XML in svg.path)
{
     // do stuff... trace(pathXML.@stroke)
}

// This one works, the loop iterates once over the single path element...
var svg:XML = 
    <svg>
     <path stroke="#00FF00" />
    </svg>


// This one doesn't, the loop just exits.
var svg:XML = 
    <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="612px" height="792px" viewBox="0 0 612 792" enable-background="new 0 0 612 792" xml:space="preserve">
  <path fill="#FFFFFF" stroke="#000000" d="M160.333,372.444c0,0,17.778-115.555,60-63.333s27.778-106.666,78.889,40" />
    </svg>

The difference is that your second XML are using a namespace. 不同之处在于您的第二个XML正在使用名称空间。 You can find a solution here . 您可以在此处找到解决方案。 Hope it helps. 希望能帮助到你。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM