Mám XML, ktorý je štruktúrovaný nasledovne, chcel by som získať atribút meny v AS3 bez ohľadu na značku SellTotosystem, pretože budem mať vždy rôzne značky.
<GCPRequest version="1" requestId="1234567890">
<SellTotoSystem currency = "EUR">
</SellTotoSystem>
</GCPRequest>
odpovede:
1 pre odpoveď č. 1Môžete použiť jeden z nasledujúcich príkladov:
var xml:XML = <GCPRequest version="1" requestId="1234567890">
<SellTotoSystem currency = "EUR"></SellTotoSystem>
</GCPRequest>;
var currency:String;
//first child at the first level of tree
currency = xml.*.@currency[0];
trace(currency);
//first encounted child at any level of tree
currency = xml..@currency[0];
trace(currency);
//output:
EUR
EUR