开发者

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.

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" />开发者_如何学Python;
    </svg>


The difference is that your second XML are using a namespace. You can find a solution here. Hope it helps.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜