2 weeks have passed since this question was asked, but there will always be more people in need of help.
TypeError: Error # 1089 caused by the result of more than one object in xml.
I usually accepted this error with the operation = xml.classes. (@id == 1) .students. (@no == 2). @Grade = "A"; The error was caused by the fact that there was more than one student in xml.class, so he tried to return all of them. As the error says: "Assigning to lists with more than one item is not supported." You cannot assign a value to multiple objects at the same time.
And since you add all s to the XMLList, I am not sure of the reason, since I am not using XMLList. it is useless, as I think. Therefore, if you change your code as
var xml:XML = <test> <node id='1'/> <node id='2'/> <node id='3'/> <node id='4'/> <node id='5'/> </test>; for each (var n:XML in xml) { n.@newAttribute = "1"; }
The problem must be resolved. But I suggest you use "id" as a unique key. Then you can use this unique key to access certain elements in XML, for example
xml.node.(@id=="1") .@newAttribute ="1";
Hope this helps you. be careful
-Ozan
source share