e4x

mulitple attribute xml filter as3 e4x

I am trying to come up with the best xml schema to support tag filtering. And then a method to filter the xml on an arbritary amount of tags. So here is the xml: var videoXML:XML= <?xml version="1.0" encoding="UTF-8"?> <videos> <video> <tags label="dogs,brown,lawns" /> </video> <video> <tags label="dogs,cats" /> </v...

Concat E4X expressions in ActionScript 3

Is there any way to concatenate E4X expressions? If I store "half" a path in a variable, can I concatenate the way I do with Strings? ...

Parsing XML with nodes containing underscores.

How do I parse an XML document that contains nodes where underscores exist? <some_xml> <child_node> <child width_info="" height_info="" /> </childnode> </some_xml> I tried this: for each (var item:XML in Environment._XMLData.some_xml.child_node.child){ trace(child.@width_info); } But that does'nt seem to work. I...

How to query an XML File with E4X in AS3?

I need to archive a database-driven flash as3 website. I exported a table to xml so now i have something like this: <RECORDS> <RECORD> <id>home</id> <msg>bodytext</msg> <type>0</type> <lastEditDate>0000/0/0 00:00:00</lastEditDate> <lastAccessDate>2009/6/17 11:37:21</lastAccessDate> <timesAccessed>855</timesAcce...

e4x statement conflicts with local variable?

Hi, griends! Somewhere in code i have decalred variable: [Bindable] var nameWin:String = ""; after this i have an e4x statement podContent.xml_m = xml_m.item.(nameWin=="necessary name"); that should compare item's namewin with "necessary name" and return only items whose nameWin matches with "necessary name". xml_m.item: <item>...

e4x filter on more than one children?

My XML Looks like this: <?xml version="1.0" encoding="utf-8" ?> <projects> <project id="1" thumb="media/images/thumb.jpg" > <categories> <id>1</id> <id>2</id> </categories> <director>Director name</director> <name><![CDATA[IPhone commercial]]></name> ...

Filtering in E4X

This is just a simple question. I'm currently using Mozilla's Rhino to develop a little webapp. As one step, I need to get a webpage and filter all of it's nodes. For doing that, I use E4X. I thought I could do this like that: var pnodes = doc..*(p); But that produces an error. How is it done right? (BTW: this is just a step for incr...

Fix internal links in JS

I just created a script which extracts the article out of a webpage via server-side JS. (If your interested: it's used for http://pipes.yahoo.com/fb55/expandr .) I just got a little problem with internal links. Some pages include links like: /subfolder/subpage.html What I would need to do is fixing them and setting there root, like t...

delete XML node, keep original

I need to delete some nodes from an XML variable and I want to keep the original intact. So I pass the XML to a new variable and delete the nodes from that one but the original changes with it. Is there a way to protect the XML from the original variable? ...

Actionscript 3 E4X working with namespace values in XML

I am building an application using Action script 3 I am retrieving some XML from the web however the node names are mms:Image mms:Results etc my action script compiler is throwing an error becuase it is not expecting to see the semi colon in the node name. How to I access the nodes? thanks ...

Javascript E4X: How do I properly iterate over an attribute XMLList?

Hi, I have a problem with retrieving attribute values via E4x in javascript. Suppose a list of XML nodes like the following as the XMLObject: <node att1="value1" att2="value2" att3="value3" att4="value4"> <nodeChild><!CDATA[/* ... */]></nodeChild> /* more node childs */ </node> I properly accessed the nodes (in a loop) and i...

How do nested tags work in E4X?

Suppose I have the following XML: var foo:XML = <root><a>this is a <b>special</b> case</a></root> Is there any way to detect the position of <b> relative to the contents of <a> without a custom subparser? ...

How can I create and Apache Axiom element from a E4X object from a script running in Rhino?

I am running a script running in Rhino, which creates an E4X object like this: var s = <product id="123"> <name>Google Search</name> <source>https://google.com&lt;/source&gt; </product> I want to include such XML in a SOAP message. I am using Apache Axis 2 ServiceClient for creat...

getElementsByTagName in E4X

Hi, I'm searching a possibility to get an array of elements in E4X for an unknown tagname (like the DOMs getElementsByTagName) inside of a function. My first thought was something like: (function (doc, tag) { return doc..[tag]; }) Is there any chance to do this? ...

Many names of JavaScript / ECMA

I was looking up newer functions of JavaScript and found ECMAScript/ECMA 5. Because I had never heard of it I looked in to it more and found that it comes in the form of different names such as: JavaScript, JScript (Microsofts Variation), ECMAScript, ECMA 5, E4X (JavaScript for Xml)and many others From what I have read it seems that ...

Chrome Uncaught SyntaxError: Unexpected token <

Trying to use cdata to store css but chrome throws "Uncaught SyntaxError: Unexpected token <" for the first line below: var default_style = <![CDATA[ .TTContent table td.Mission img { max-height: 15px;} ]]>.toXMLString(); Does anyone knows why? P.s. the css is much longer in reality Many thanks, ...

flash AS3 e4x - getting hold of child nodes

I am aware that you can use syntax such as: xml..Group And this is supposed to return an XMLList of Groups anywhere in the xml. This works fine if I have more than one , but fails if there is only one . Am I wrong in my assumption that it should return one? I trace xml..Group.length() and it is 0, but the Group is definately in the x...

Rhino, e4x and generating URLs in XHTML

I'm using Rhino to generate XHTML but my urls are being encoded as in: -http://www.example.com/test.html?a=b&amp;c=d becomes -http://www.example.com/test.html?a=b&amp;amp;c=d Failing test case as follows: public class E4XUrlTest extends TestCase { public void testJavascript() throws Exception { final Context context = ne...

find out if AS3's XMLList contains string as node value

Is there an XMLList equivalent to Array.indexOf? For example - var array:Array = ['one','two']; trace(array.indexOf('two')); // returns 1, since it's at the second position trace(array.indexOf('three')); // returns -1, since it isn't found ... right? but what if I've got this - var xml:XML = <list><item>one</item><item>two</item><...

Flex: Listening for CollectionEvent in custom component

(EDIT: I've edited my question to make it simpler, sorry if some answers are out of context) I have prepared a reduced test case for my question: I'm trying to create a custom component which is being fed with XML data coming from the server. My problem is that the CollectionEvent listener doesn't get fired and thus labels no...