[英]Filter XML with E4X
I have this XML: 我有这个XML:
public var translations:XML =
<translations>
<firstName>
<en>first name</en>
<fr>prénom</fr>
</firstName>
<lastName>
<en>last name</en>
<fr>nom de famille</fr>
</lastName>
</translations>
I would like to reduce it to the below: 我想将其简化为以下内容:
<translations>
<firstName>first name</firstName>
<lastName>last name</lastName>
</translations>
In the above I have removed the en
& fr
nodes, I have consolidated the string from en
into their place. 在上面,我删除了
en
& fr
节点,将字符串从en
合并到它们的位置。 I know I'm able to do this with a for loop but I'd prefer an E4X query if possible. 我知道我可以通过for循环执行此操作,但如果可能的话,我希望使用E4X查询。
I think the whole idea to be able to iterate over E4X Xml is to be able to have AS operators useful for Xml. 我认为能够在E4X Xml上进行迭代的整个想法是能够使AS运算符对Xml有用。 Even Adobe's own page ( http://help.adobe.com/en_US/as3/dev/WS5b3ccc516d4fbf351e63e3d118a9b90204-7e72.html ) suggests using loop.
甚至Adobe自己的页面( http://help.adobe.com/zh_CN/as3/dev/WS5b3ccc516d4fbf351e63e3d118a9b90204-7e72.html )都建议使用循环。 In effect, I don't think you can accomplish this via '..', '@', '[]' operators.
实际上,我认为您无法通过'..','@','[]'运算符来完成此操作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.