Use E4X to total the prices of all of the elements with a price attribute
package{
import flash.display.Sprite;
publicclass Main extends Sprite{
public function Main(){
var cart:XML = <cart>
<item price=".98">crayons</item>
<item price="3.29">pencils</item>
<group>
<item price=".48">blue pen</item>
<item price=".48">black pen</item>
</group>
</cart>;
var total:Number = 0;
for each ( var price:XML in cart..@price ) {
total += price;
}
trace( total );
}
}
}