But, according to how I’m reading the spec, the following should work, but it doesn’t:
list4 = new XMLList(); list4[0] = <a id="1"/>; list4[1] = <a id="2"/>; list4[2] = <a id="3"/>; list1 += list4 + xml2.z; On May 6, 2016, at 11:29 AM, Harbs <harbs.li...@gmail.com> wrote: > I got rid of just about everything and it still was not working. > > I finally replaced list1 += list4 with xml2.a += list4 and that works. > > So the following does not work: > list1 = xml2.a; > list1 += list4; > > But the following does: > xml2.a += list4 > > I’m guessing that the reason the second case works is because it’s actually > reassigning all <a> elements of the original xml with the new XMLList. > > So the following does what I want: > > for(i=0;i<list4.length();i++){ > list1[list1.length()] = list4[i]; > } > > which is different than: > > list1 += list4; > > But: > > If I do this: > > list4 = xml2.z; // z does not exist > list4[0] = <a id="1"/>; > list4[1] = <a id="2"/>; > list4[2] = <a id="3"/>; > > instead of this: > list4 = new XMLList(); > list4[0] = <a id="1"/>; > list4[1] = <a id="2"/>; > list4[2] = <a id="3"/>; > > I get the elements appended to the XML. > Bizarre, but this does jive with your reading of the spec. > > On May 6, 2016, at 10:53 AM, Alex Harui <aha...@adobe.com> wrote: > >> Hmm. >> >> Did you try commenting out lines of code in your first example until it >> looks like this employees example? Maybe one of the lines cause a bug. I >> wasn't sure what list1[0][0][0] would be, for example. >> >> Or comment out the <c /> node. I just noticed that the append may have >> picked up the name() from the last node, not the last node in the XMLList, >> and that would be a bug, IMO. >> >> -Alex >> >> On 5/6/16, 12:21 AM, "Harbs" <harbs.li...@gmail.com> wrote: >> >>> No. That’s not it. >>> >>> For example, this: >>> >>> var e = <employees> >>> <employee id="1"><name>Joe</name><age>20</age></employee> >>> <employee id="2"><name>Sue</name><age>30</age></employee> >>> </employees>; >>> // append employees 3 and 4 to the end of the employee list >>> var newE:XMLList = new XMLList(); >>> newE[0] = <employee id="3"><name>Fred</name></employee>; >>> newE[1] = <employee id="4"><name>Carol</name></employee>; >>> e.employee += newE; >>> trace(e); >>> >>> outputs: >>> <employees> >>> <employee id="1"> >>> <name>Joe</name> >>> <age>20</age> >>> </employee> >>> <employee id="2"> >>> <name>Sue</name> >>> <age>30</age> >>> </employee> >>> <employee id="3"> >>> <name>Fred</name> >>> </employee> >>> <employee id="4"> >>> <name>Carol</name> >>> </employee> >>> </employees> >>> >>> There’s something about the XML in my test case which is preventing the >>> appending of either XML or XMLList to the original XML object. It feels >>> to me like a bug in Flash… >>> >>> On May 6, 2016, at 10:06 AM, Alex Harui <aha...@adobe.com> wrote: >>> >>>> Well, the spec is checking to see if the thing appended is an XMLList >>>> and >>>> in the above example, I think you are appending XML not XMLList so that >>>> might explain the different behavior. >>> >> >