문제

I have this 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. I know I'm able to do this with a for loop but I'd prefer an E4X query if possible.

도움이 되었습니까?

해결책

I think the whole idea to be able to iterate over E4X Xml is to be able to have AS operators useful for Xml. Even Adobe's own page (http://help.adobe.com/en_US/as3/dev/WS5b3ccc516d4fbf351e63e3d118a9b90204-7e72.html) suggests using loop. In effect, I don't think you can accomplish this via '..', '@', '[]' operators.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top