flex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Harui <aha...@adobe.com>
Subject Re: [FALCONJX][FLEXJS] XML handling (was Re: [FlexJS] Back port)
Date Mon, 16 Nov 2015 19:14:41 GMT


On 11/16/15, 10:54 AM, "Harbs" <harbs.lists@gmail.com> wrote:

>
>On Nov 16, 2015, at 8:03 PM, Alex Harui <aharui@adobe.com> wrote:
>
>> 
>> 
>> On 11/16/15, 9:54 AM, "Harbs" <harbs.lists@gmail.com> wrote:
>> 
>>>> 2) detect read and write on XML/XMLList and convert read to child().
>>>> What
>>>> about write()?
>>> 
>>> Good question. I think we should map xml.foo = <foo id=“1"/> to
>>> xml.replace(“foo”,new XML(“<foo id=\”1\”/>”));
>> 
>> What does the above actually do if there is only one foo child and if
>> there are more than one foo.child?
>
>1. xml.foo = someXML replaces all foos with someXML (in the location of
>the first foo)
>2. xml.foo = someXMLList removes all foos and adds in the ones from the
>list (in the location of the first foo)
>
>> Do you know if you can use += to append?
>
>How do you like that? I’ve never thought of trying +=! I just tried and
>it works like a charm! It adds it in after the last foo or at the end if
>foo does not exist.

Hmm.  I wonder what other operators work.  Like “-=“.  And does xmlList1 +
xmlList2 concatenate them?

>
>I’m not sure what the best mapping for this will be. We probably should
>get a reference to the last foo and map it to
>xml.insertChildAfter(lastFoo,newFoo) if there are any foos. Otherwise it
>should map to appendChild().

OK.  Thanks for doing the testing.

The compiler cannot know whether there will be a foo at compile-time, so
for all of these cases, I think we’ll have to call a new setChild() method
and your code will have to “do the right things”.

Replacing “=“ expressions with method calls is quite painful in the
compiler and the output can look very messy.  What do you think about
implementing setChild as a setter instead of a method?

-Alex

Mime
View raw message