Ho un XML strutturato come il seguente, mi piacerebbe ottenere l'attributo currency in AS3, indipendentemente dal tag SellTotosystem, perché avrò tag diversi ogni volta.
<GCPRequest version="1" requestId="1234567890">
<SellTotoSystem currency = "EUR">
</SellTotoSystem>
</GCPRequest>
risposte:
1 per risposta № 1È possibile utilizzare uno dei seguenti esempi:
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