XML: cycle through variable number of attributes. Any ideas?

EDIT - worked it out But Krilnon had better solution.

Hi,

I have some data stored in an XML. The XML node has an unknown number of attributes. I want to cycle through the attributes and add them to an array. All suggestions or ideas are very welcome!!

my current thoughts are to have somthing like this
XML:

<X>
<O V0="xxx"V1="aaa"V2="bbb"V3="ccc"></O>
</X>

then

var xd:XML = new XML();
//load the xml into the xd as usual then

for(var i:uint = 0; i < 100; i++)
{
     var attribute:String = 'V'+String(i);
	 var nodeData:String = xd.O.@[attribute] // fixed this line and now works
       if(nodeData == "") break;
	 myArray.push(nodeData)
}

Thank you for your help!

S.