我有以下的XML文档:
I have the following XML document:
<tt xmlns="http://www.w3.org/ns/ttml" xmlns:tts="http://www.w3.org/ns/ttml#styling" xml:lang="en">
<head></head>
<body>
<div xml:lang="it">
<p begin="00:00:00" end="00:00:02" style="violet">first</p>
</div>
</body>
</tt>
我加载内容到成功使用AS3我的Flash对象。但是,如何打印/跟踪属性的值&LT; DIV XML:LANG =它&GT;
?当我尝试在code:
I load the contents into my flash object using AS3 successfully. But how do print/trace the value of the attribute in <div xml:lang="it">
? When I try the code:
trace(myxml.children()[1].children()[0].@xml:lang);
编译器抱怨由冒号psented语法错误$ P $。
The compiler complains about the syntax error presented by the colon.
在你的XML没有XML的命名空间。也许你错过了。应该是这样的:
In your xml there is no 'xml' namespace. Probably you missed it. Should be something like this:
<tt xmlns:xml="http://blabla.com" ... xml:lang="en">
然后,你需要声明命名空间实例访问XML属性,标签的命名空间:
Then you need to declare Namespace instance for accessing xml attributes, tags for that namespace:
var ns:Namespace = new Namespace("xml","http://blabla.com") ;
然后你可以使用这个code访问属性:
Then you can use this code to access attribute:
trace(myxml.children()[1].children()[0].@ns::lang);
上一篇:的Windows的SendTo上下文菜单针对Adobe AIR?上下文、菜单、SendTo、Windows
下一篇:在ActionScript 3调整大小的BitmapData大小、ActionScript、BitmapData