e4x

E4X: grab nodes with namespaces?

I want to learn how to process XML with namespaces in E4X so basically here is what I want to learn, say I have some XML like this: <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/"&gt; <rdf:item value="5"/> <item value="10"/> </rdf:RDF> How could I assign < rdf:item /> to a v...

E4X filter by text content?

I'm trying to filter some XML in JavaScript using E4X and have some specific needs. Given the following: var xml = <body> <div> <p>This is some text that I have.</p> </div> </div>; I want to search the document for paragraphs starting with "This is some text". Currently I can the following to get at the ...

use flash as proxy for e4x?

I really like processing XML with e4x, any other method I just get confused and can't seem to get it to work. So I was thinking about maybe making a proxy in flash to use to process xml with e4x (I would use this for JavaScript and maybe PHP if I could figure out a way). Basically passing it an xml object and an e4x expression and return...

Filter XMLList to nodes/attributes that have a certain namespace prefix

Hi all, This is best explained using an example. I have an xml document that has namespace qualified elements. What I want to do is search the xmlList to see how many namespace qualifier elements and/or attributes there are. So for example some text So for the above xml doc the namespace xsi would have 1 node returned from a search...

How can I interpret an E4X property as a Date in Flex?

I've got XML that looks like this: <item> <itemDate>07/10/2009</itemDate> </item> I would like to be able to read this in as an E4X object: item.itemDate and have itemDate be an ActionScript Date object instead of a string. Is this possible? ...

How can I detect the child element of a variable parent in E4X (Flex 3, specifically)?

I have XML that looks like this: <question> <type_elt> <opt_out_flag /> </type_elt> </question> type_elt is not an element name; it might be <single>, <multiple> or something else, determined at runtime. How, given this, can I detect the presence of the opt_out_flag element? I tried this (where xml refers to the ques...

Count the number of nodes in an XML snippet using Javascript/E4X

Consider this problem: Using Javascript/E4X, in a non-browser usage scenario (a Javascript HL7 integration engine), there is a variable holding an XML snippet that could have multiple repeating nodes. <pets> <pet type="dog">Barney</pet> <pet type="cat">Socks</pet> </pets> Question: How to get the count of the number of pet ...

Load xml file in flex before application start/intialises

Hi, I've got a configuration xml file that I need to parse for values before a flex application laods. I've created a static class that allows for the values in the xml config file to be retrieved. I'm initialising this class when the application first loads but as the xml file is loaded with a Loader class that loads a synchronously ...

Javascript E4X: Select a node based on an attribute value

Consider this scenario: Using Javascript/E4X, in a non-browser usage scenario (a Javascript HL7 integration engine), there is a variable holding an XML snippet that could have multiple repeating nodes. <pets> <pet type="dog">Barney</pet> <pet type="cat">Socks</pet> </pets> Code: var petsXml; // pretend it holds the above xm...

Use a String as an E4X Expression in AS3?

I need to use a string to access nodes and attributes in XML using E4X. It would be ideal to have this scenario (with XML already loaded): var myXML:XML = e.target.data; var myStr:String = "appContent.bodyText.(@name == 'My Text')"; myXML.myStr = "New Value for bodyText node where attribute('name') is equal to 'My Text'"; I ultimate...

E4X Add CDATA content

Basically I need to define a node name and its CDATA content using variables. var nodeName:String = "tag"; var nodeValue:String = "<non-escaped-content>"; Naively I thought this would work : var xml:XML = <doc><{nodeName}><![CDATA[{nodeValue}]]></{nodeName}> Outputs : <doc><tag><![CDATA[{nodeValue}]]></tag></doc> In a previous v...

How can I determine the position of an XML instance in an XMLList in ActionScript3?

What it says on the tin: I have an XMLList, and I want to find where in it a particular XML item falls. First index is good enough for my purposes. Note that I have no problem writing a function to do this by hand... but I was hoping that the API has something buried somewhere that'll do it for me. I didn't see it, though. ...

E4X: Insert nodes in XMLList for missing date?

if I have an XML object like this: <a> <u date="2009-04-10" value="543"/> <u date="2009-04-11" value="234"/> <u date="2009-04-13" value="321"/> <u date="2009-04-14" value="66"/> <u date="2009-04-16" value="234"/> <t date="2009-04-01" value="43"/> <t date="2009-04-02" value="67"/> <t date="2009-04-03"...

Flex: XMLList of attirubites.... convert to nodes?

say I have an xmllist like this (but with many other attributes not shown for brevity): <node metal="white gold"/> <node metal="yellow gold"/> <node metal="silver"/> and I access the metal attributes via xmllist.@metal which will give me a new xmllist like this: white gold yellow gold silver I want to convert that to an xmllist tha...

using e4x to retrieve xml from Flex webservice result handler

Hi, I'm trying to use e4x to retrieve xml from the result event thrown when my Flex webservice is successful. This is a snippet of the returned xml <p430:getRoomsResponse xmlns:p430="http://impl.service.com"&gt; <p430:getRoomReturn type="p888:Room" xmlns:p888="http://vo.room.com" xmlns="http://www.w3.org/2001/XMLSchema-instance"&gt; ...

Issues with most basic e4x test

When I load a page containing e4x in FF 3.5, I get no inkling that e4x even exists in the browser's JS implementation. Notes below, but here's my HTML : <html xmlns="http://www.w3.org/1999/xhtml"&gt; <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>e4x test</title> ...

Can E4X Get Attribute of a Parent Node Based on Attribute of a Child At Any Level?

Hi, I'm struggling with some E4X and hope you can help. Here's my XML structure: <xml> <node type="bar"> <subnode id="4"> <subnode id="5"/> </subnode> <subnode id="6"/> </node> <node type="foo"> <subnode id="7"> <subnode id="8"> <subnode id="9"/> </subno...

e4x: how to best check existence of an attribute?

I know I can do it with the length() method: >x = <a attr1='33' /> >x.@attr1 33 >[email protected]() 1 >[email protected]() 0 so I could use if ([email protected]() > 0) { .... do something .... } but is there a more appropriate way? ...

Can E4X Have An Array Passed To It?

Hi All, Say we have the following XML: <people> <person> <name>Jake</name> <skills> <skill>JavaScript</skill> <skill>HTML</skill> <skill>Flex</skill> <skill>CSS</skill> </skills> </person> <person> <name>John</name> <skills> <skill>C++</skill> <skill>Foxpro</skill> </skills> </person> <person> ...

E4X: Parse a document with namespaced nodes and a variable to be evaluated?

I am trying to parse a document with nodes that look something like this: <doc> <results> <result xmlns="http://www.inktomi.com/"&gt; <title>Senate Panel to Review Election Unit Sale</title> </result> </result> </doc> However the namespace and the nodename of the result could be different. If it were not so...