e4x

Deleting / Replacing A Node in E4X (AS3 - Flex)

I'm building a listing/grid control in a Flex application and using it in a .NET web application. To make a really long story short I am getting XML from a webservice of serialized objects. I have a page limit of how many things can be on a page. I've taken a data grid and made it page, sort across pages, and handle some basic filteri...

E4X : Assigning to root node

Hello, I am using Adobe Flex/Air here, but as far as I know this applies to all of JavaScript. I have come across this problem a few times, and there must be an easy solution out there! Suppose I have the following XML (using e4x): var xml:XML = <root><example>foo</example></root> I can change the contents of the example node using ...

Editing XML in Flex using e4x

Hello, In Flex, I have an xml document such as the following: var xml:XML = <root><node>value1</node><node>value2</node><node>value3</node></root> At runtime, I want to create a TextInput control for each node under root, and have the values bound to the values in the XML. As far as I can tell I can't use BindingUtils to bind to e4x ...

Actionscript3 E4X XML and CSS: Do I really have to use CDATA?

When working with CSS inside of XML such as <span class="IwuvAS3"></span> when parsed in flash, if I don't use CDATA like the following: <![CDATA[<span class="IwuvAS3"></span>]]> then the parsed data drops down a line for every "<" character it sees. When parsing the data into a single-line text field, nothing was shown because it...

Why is this E4X code not respecting the default namespace?

I'm hacking around in a Firefox extension, trying to use E4X. However, I've come across a weird problem: var myXml = <test xmlns="http://test.com"&gt; Hey <inner> Guys </inner> </test>; var ns = myXml.namespace(); default xml namespace = ns; this.log(myXml.*::inner); this.log(myXml.ns::inner); this.log(myXm...

E4X conditional call is not returning anything with only 1 match?

ok here is my code: var xml:XML = <xml> <typeA amount1="500" amount2="300" amount3="250" date="2008-02-17"/> <typeA amount1="500" amount2="300" amount3="250" date="2008-02-16"/> <typeA amount1="500" amount2="300" amount3="250" date="2008-02-17"/> <typeB amount1="500" amount2="300" amount3="250" date="2008-02-18"/> <...

Why, in AS3, are XML and XMList unrelated (inheritence wise) classes?

I can't help think that making XML ad XMLList both unrelated, as in both extend Object directly, is a design flaw in the AS3 core library. Surely having XML extend XMLList would be a much cleaner system, where XML is considered an XMLList with only one member? This would also avoid the very annoying practice of an E4X query possibly re...

How Can I get Remote Objects to return XML in E4X?

Hi there. I'm writing a Flex application that makes full use of BlazeDS to a Java server. I use Remote Objects a lot, but I've come across an instance where receiving XML is cleaner and faster than returning objects. Returning XML through BlazeDS is easy enough. I'm building up the XML with Dom4j on the Java and returning the root ...

Creating a new attribute in an XML node using E4X in AS3

Is there any way to do it? ...

How can I tell if E4X expression has a match or not?

I am trying to access an XMLList item and convert it to am XML object. I am using this expression: masonicXML.item.(@style_number == styleNum) For example if there is a match everything works fine but if there is not a match then I get an error when I try cast it as XML saying that it has to be well formed. So I need to make sure tha...

Is there anyway to use E4X in PHP?

I am primarily an ActionScript programmer and I love working with XML using E4X. I also use PHP a lot but am currently too intimidated to process XML with PHP, I was wondering if there was a way to use E4X in PHP? Thanks. ...

E4X: Expression not returning what I expected

I have an XMLList, I am trying to grab one from the list with a stone attribute == Opal but its not working, I don't understand why? Here is the code: var xml:XML = <bs><variation price="999999999.99" month="OCT" stone="Magic Pet Rock" image="https://www.sussexjewelers.com/birthstone_images/20_PE105-BT.png" style="PE105" gold_color="W...

E4X: Use string as attribute name in expression?

I have a function that has this line: var returnString:String = items[0].@month; @month is an attibute on an XML node like so: <xmlnode month="JAN"/> OK but I need to abstract the attribute name so I can pass a string to the function and get the contents of the attribute with the name matching the string I passed. So for example If...

Why can't I access xml nodes with out namespaces?

I've been banging my head on my desk for hours trying to figure out why I can't access the entry.author.name content? I've tried every possible way to access it but failed. But when I loop through all nodes with xml.children I see the author node. I see the author node is apart of the atom namespace but it doesn't have a namespac...

Parsing XML with AS3

Here is my entire Script as I can't seem to figure out where the problem is. The symptoms are that where I addChild(book) , is not the appropriate place for this to be added properly and sequentially with the thumbs as well. As a result, and to my surprise, the only way I can get these to appear so far is by writing a faulty trace state...

Renaming XML nodes using E4X in AS3

I have an XML object in AS3 that is formatted as follows: <data> <nodes> <item></item> <item></item> ... </nodes> <nodes> <item></item> <item></item> ... </nodes> ... </data> My problem is I want to rename the node names("nodes" and "item") to something more relevant e.g. "nodes" could be "author", an...

E4X: sort XMLList by month?

I am trying to sort an XML list by month, the actual tags have more attributes than just month but for brevity I'll not include them: <var month="OCT"/> <var month="NOV"/> <var month="JAN"/> <var month="MAR"/> <var month="SEP"/> <var month="JUL"/> <var month="APR"/> <var month="AUG"/> <var month="DEC"/> <var month="FEB"/> <var month="MA...

Atom data binding not working

Hi guys To make it simple, I've got a Flex application with Advanced Data Grids binded with XML and Atom feeds. With my XML file, the application works very well: jiraList = new XMLList(event.result.channel.item); However, when I try to access Atom feeds, I cannot go lower than "event.result". This works: clarityList = event.res...

Process XML returned via Ajax with E4X?

I am loading some XML via Ajax. here is a snippet of the script: ajaxRequest.onreadystatechange = function() { if(ajaxRequest.readyState == 4) { document.getElementById('loading').innerHTML = 'done'; google_xml = ajaxRequest.responseXML; document.getElementById('xml').innerHTML = 'XML: '+google_xml.toXML...

e4x query based on sub attributes

I'm trying to execute an E4X query (on the xml below) that will return all "accessor" nodes that contain a "metadata" node with a "name" attribute that equals "Required". I tried... type.accessor.(metadata.@name == "Required") ...but that only works for accessor nodes that have only 1 metadata node. Any clues? <type name="org.sprin...