我有以下xml
var xml:XML = <test>
<node id='1'/>
<node id='2'/>
<node id='3'/>
<node id='4'/>
<node id='5'/>
</test>;
var xmlist:XMLList = xml.children();
for each (var node:XML in xmlist)
{
node.@newAttribute = "1";
}
我正在遍历每个节点并添加一个属性。如何在不循环的情况下做到这一点?我试过这个
xmlist.attributes().@newAttrib = "1";
但我收到错误“ TypeError: Error #1089: Assignment to lists with more item is not supported ”。