FWIW, I also tried
list1 += < id=“1”/>;
instead of
list1 += list4
but that did not work either.

I re-read the spec and it does look like you are reading it right, but it does 
not make sense to me and I don’t know how that jives with the behavior in other 
cases. For example (from the spec):

> Similarly, after evaluating the statements below, 
> 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 
> e.employee += <employee id="3"><name>Fred</name></employee> + 
> <employee id="4"><name>Carol</name></employee>; 
> the variable “e” would contain the XML value: 
> <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>; 

If e.employee loses its targetObject I don’t see how 3 and 4 get appended to 
the XML.

I also have no idea what this comment means:
> Note, however, that the "+=" operation does not necessarily preserve the 
> identity of the XML object specified by the LeftHandSideExpression. 

I do believe that my case is pretty “fringe”. I don’t expect that people are 
adding objects to XMLLists and relying on the fact that it will not get added 
to the original XML.

I’m ready to call it a day and say the XML is ready for the 0.7.0 release. I 
fully expect there to be more bugs (especially revolving around namespaces 
which is not tested very well), but my test cases are all working well.

Harbs

On May 6, 2016, at 1:45 AM, Alex Harui <aha...@adobe.com> wrote:

> Baffling, isn't it?  Reading the spec is equally baffling, but I think I
> see for XMLList Append, that the targetObject of the appended XMLList
> becomes the targetObject of the destination XMLList!  That seems really
> surprising to me and why they would do that doesn't jump to mind, but I
> think that's what I see.
> 
> HTH,
> -Alex
> 
> On 5/5/16, 12:49 AM, "Harbs" <harbs.li...@gmail.com> wrote:
> 
>> I have a situation where the FlexJS output is different than the Flash
>> output of XML, but it seems to me like the Flash output is wrong. I’m not
>> sure what I’m missing:
>> 
>> Here’s the (stripped down) code:
>> 
>> var xml2:XML = new XML('<root
>> xmlns:fz="http://ns.adobe.com/mxml/2009";><a><b/></a><a
>> name="fred"/><a>hi<b>yeah!</b></a><a name="frank"/><c/></root>');
>> var list1:XMLList = xml2.a;
>> var aaa = list1[0];
>> var aab = list1[0][0][0];
>> var list2:XMLList = xml2.child("a");
>> var list3:XMLList = xml2.descendants();
>> list3  = list3.(attribute("name").length());
>> list2[list2.length()] = <c id="1"/>;
>> list2[0] = <bla/>;
>> var list4:XMLList = new XMLList();
>> list4[0] = <a id="1"/>;
>> list4[1] = <a id="2"/>;
>> list4[2] = <a id="3"/>;
>> list1 += list4
>> trace("after concat");
>> trace(xml2.toString());
>> 
>> In Flash the output is:
>> 
>> after concat
>> <root xmlns:fz="http://ns.adobe.com/mxml/2009";>
>> <bla/>
>> <a name="fred"/>
>> <a>
>>   hi
>>   <b>yeah!</b>
>> </a>
>> <a name="frank"/>
>> <c id="1"/>
>> <c/>
>> </root>
>> 
>> In JS, the output is:
>> 
>> after concat
>> <root xmlns:fz="http://ns.adobe.com/mxml/2009";>
>> <bla/>
>> <a name="fred"/>
>> <a>
>>       hi
>>  <b>yeah!</b>
>> </a>
>> <a name="frank"/>
>> <c/>
>> <c id="1"/>
>> <a id="1"/>
>> <a id="2"/>
>> <a id="3"/>
>> </root>
>> 
>> Ignoring the order of the “c” elements for right now (which is a bug I’m
>> going to fix), it seems to me that the three “a” elements that appear in
>> the JS output is correct. I don’t know why Flash does not append the
>> elements to the original XML.
>> 
>> Does anyone have any ideas?
>> 
>> Harbs
> 

Reply via email to