Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I don’t recall being able to construct XML inline like this unless maybe that was a Flex server thing?


I don't recall being able to do the XML construction inline either, but that just might be my memory.

However, the XML selector syntax was a godsend. Recursively parsing an XML tree is really a pain. E4X would allow you to do things like:

    var foo = someXml..childNodes.@attribute;
I'm not even sure if that would work actually. There were a bunch of operators for doing things like getting a collection of children that all had the same tag so you could work with XML like:

    <someXml>
       <intermediateNodeYouWantToSkip>
           <childNode attribute="1" />
           <childNode attribute="2" />
           <childNode attribute="3" />
           <unrelatedNode />
       </intermediateNodeYouWantToSkip>
    </someXml>
Another post here said people didn't want it, but I don't think that was the real reason it was dropped. There was a lot of drama at the time about Flash in general and a massive debacle about EcmaScript 4 (which ActionScript more or less adopted). There was also the whole XHTML thing happening.

Basically JSON as a format won out over XML and ES4/XHTML were ditched. Frankly, a world that revolved around XML/SOAP would have been a nightmare, so I guess killing off the easy processing of XML in JavaScript helped to stave off that potential future. XSS, XSLT and E4X were all casualties.


It was an extension to ES4 called E4X - it allowed inline xml along with a new xml data type. More info here: https://evertpot.com/ecmascript-4-the-missing-version/


I think parent must be referring to Flex components. AS3 itself had an XML library which I recall being absolute hell to work with. The better way to send things over the wire with AS3 was with AMF.


Nope. I worked with Flex and it's MXML files extensively. But the parent is talking about E4X, which was an extension to ECMAScript that allowed you to use XML elements inline with JavaScript in a manner VERY similar to how JSX is used today. It also included the ability to much more easily query and otherwise work with those XML document trees in native JavaScript.


No, writing XML was the declarative part of Flex (like HTML), but AS3 had it’s own XML type so you could do things like this:

var data:XML = <foo><bar>hello</bar></foo>

and then data was an object instance like you’d expect




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: