If possible, try to break up things into "beads" that are replaceable, so folks can swap in different behaviors if needed. A flag ends up bringing in code for all behaviors, "just in case".
-Alex On 12/30/15, 3:45 PM, "Harbs" <harbs.li...@gmail.com> wrote: >DOMParser allows for more graceful handling of XML parsing errors than >we’re used to in Flash (or classic E4X). > >I’m not sure the best way to handle this on the JS side. I see three ways >to handle errors: > >1. I could just do what the Flash runtime does and just throw an error if >there’s any kind of parsing error (like unclosed tags and the like). >2. I could swallow errors that are thrown when a valid document is >produced. >3. I could return the XML object, but record the errors in the object. > >I guess there could be a flag on these behaviors if that makes sense. > >Thoughts? > >On Dec 30, 2015, at 8:02 PM, Alex Harui <aha...@adobe.com> wrote: > >> >> >> On 12/30/15, 9:16 AM, "Harbs" <harbs.li...@gmail.com> wrote: >> >>> And I’m assuming the signature will be something like this: >>> setChild(nameOrQualifiedName:String,xmlOrXmlList:Object) >> >> AS: myXML.someChild = someXMLorXMLList; >> >> JS: myXML.setChild('someChild', someXMLorXMLList); >> >> No idea of that actually is the case or not, I'm just looking at the >> compiler source ;-). And we can change it if you want. >> >> -Alex >> >>> >>> On Dec 30, 2015, at 6:13 PM, Harbs <harbs.li...@gmail.com> wrote: >>> >>>> OK. I think we discussed this, but it’s been a few weeks… ;-) >>>> >>>> The method will accept either an XML or XMLList object. >>>> >>>> On Dec 30, 2015, at 5:20 PM, Alex Harui <aha...@adobe.com> wrote: >>>> >>>>> For assignment, there will be a call to setChild(). >>>>> >>>>> On 12/30/15, 3:09 AM, "Harbs" <harbs.li...@gmail.com> wrote: >>>>> >>>>>> The past month or so, I’ve been side-tracked with lots of things, >>>>>>but >>>>>> I’m >>>>>> finally back on this. >>>>>> >>>>>> I’m not sure what we decided in terms of assignment. AFAIK, there’s >>>>>>no >>>>>> assignment method in XML for replacing XML with a specific name with >>>>>> an >>>>>> XMLList. The closest we have is replace() which takes an XML object >>>>>> and >>>>>> not an XMLLIst. I’m not even sure what it does. (I guess I can try >>>>>>it >>>>>> and >>>>>> see.) >>>>>> >>>>>> Harbs >>>>>> >>>>>> On Nov 19, 2015, at 9:06 AM, Alex Harui <aha...@adobe.com> wrote: >>>>>> >>>>>>> OK, I've pushed changes that handle basic for loops and setting >>>>>>> properties. And even += on XMLLists. >>>>>>> >>>>>>> You can get a sense of what works by looking at the unit tests in >>>>>>> >>>>>>> >>>>>>> >>>>>>>compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/f >>>>>>>le >>>>>>> xjs >>>>>>> /T >>>>>>> estFlexJSGlobalClasses.java >>>>>>> >>>>>>> >>>>>>> I'm sure there are lots of cases I haven't thought of, but it will >>>>>>> hopefully get you started. >>>>>>> >>>>>>> -Alex >>>>>>> >>>>>>> On 11/18/15, 3:12 PM, "Alex Harui" <aha...@adobe.com> wrote: >>>>>>> >>>>>>>> I pushed changes to not use _as3_ on XML function calls and use >>>>>>>> child() >>>>>>>> for "." access. >>>>>>>> >>>>>>>> I'm going to look into: >>>>>>>> -for and foreach >>>>>>>> -setting properties on XML/XMLList >>>>>>>> >>>>>>>> -Alex >>>>>>>> >>>>>>>> On 11/16/15, 11:47 AM, "Alex Harui" <aha...@adobe.com> wrote: >>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> On 11/16/15, 11:43 AM, "Harbs" <harbs.li...@gmail.com> wrote: >>>>>>>>> >>>>>>>>>> >>>>>>>>>> On Nov 16, 2015, at 9:40 PM, Harbs <harbs.li...@gmail.com> >>>>>>>>>>wrote: >>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> On Nov 16, 2015, at 9:14 PM, Alex Harui <aha...@adobe.com> >>>>>>>>>>>wrote: >>>>>>>>>>> >>>>>>>>>>>> Hmm. I wonder what other operators work. Like “-=“. >>>>>>>>>>> >>>>>>>>>>> It looks like -= does not work. >>>>>>>>>>> >>>>>>>>>>>> And does xmlList1 + xmlList2 concatenate them? >>>>>>>>>>> >>>>>>>>>>> Yes. >>>>>>>>>> >>>>>>>>>> += also works for this. >>>>>>>>> >>>>>>>>> Hmm. Easiest for the compiler might be an operator(op:String, >>>>>>>>> data:*) >>>>>>>>> method. Let’s table this stuff for now. I might have a better >>>>>>>>> idea >>>>>>>>> once >>>>>>>>> I’m actually doing the other compiler work. >>>>>>>>> >>>>>>>>> -Alex >>>>>>>>> >>>>>>>> >>>>>>> >>>>>> >>>>> >>>> >>> >> >