views:

22

answers:

1

For example
i want to change
<item id="1"/>
to
<item code="1"/>

thanks.

+1  A: 

You can use setName to change the attribute name:

Here for example change all your id attributes with code:

var xmlTest:XML=<r><item id="1"/></r>;

for each (var node:XML in xmlTest.item.descendants("@id"))
 node.setName("code");

trace(xmlTest); 
Patrick
works perfectly, thanks Patrick
Alex Freitas