thanks to all for help.

_officesXML..*.(attribute("name") == "NJ")

works for all of us perfectly :)

Grant Skinners slides (as3 workshop) are pretty good...

On Jul 9, 2008, at 6:11 PM, Kenneth Kawamoto wrote:

It's attribute("name"), not attribute(@name)

Kenneth Kawamoto
http://www.materiaprima.co.uk/

Romuald Quantin wrote:
I've tried it yet.
But I guess you might need to write it like that?
_officesXML..*.(attribute(@name) == "NJ Agency")
Romu
www.soundstep.com
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Kenneth
Kawamoto
Sent: 09 July 2008 16:42
To: 'Flash Coders List'
Subject: Re: [Flashcoders] variable in e4x filtering
Yes, I can verify that. Thanks.
_officesXML..*.(attribute("name") == "NJ Agency")
Kenneth Kawamoto
http://www.materiaprima.co.uk/
Romuald Quantin wrote:
Also, Grant Skinner explained that you can avoid:
hasOwnProperty("@name") By using :
(attribute(name) == "NJ")
It won't throw an error if the attribute doesn't exist, pretty handy.

http://gskinner.com/talks/as3workshop/
slide 91

Romu
www.soundstep.com



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Kenneth
Kawamoto
Sent: 09 July 2008 16:17
Cc: Flash Coders List
Subject: Re: [Flashcoders] variable in e4x filtering

Slightly shorter:

_officesXML..*.(hasOwnProperty("@name") && @name == "NJ Agency")

Kenneth Kawamoto
http://www.materiaprima.co.uk/

On Jul 9, 2008, at 4:51 PM, Kenneth Kawamoto wrote:

You can do something like this as well - you don't need to know the node name at all:

_officesXML.descendants().(hasOwnProperty("@name") && @name == "NJ Agency")

Kenneth Kawamoto
http://www.materiaprima.co.uk/

Pavel Kru*šek wrote:
Hi,
Unfortunately this solution is out of action: 1084: Syntax error: expecting identifier before leftbracket.
On Jul 9, 2008, at 3:50 PM, Christoffer Enedahl wrote:
Try this:

var nodeName:String = "agency";
_officesXML.[ nodeName ].(@name == "NJ Agency")

HTH
Christoffer

Pavel Kru*šek skrev:
Hi List,

please is possible to substitute node name in e4x with variable?

Anywhere in XML:
<agency name="NJ Agency">
<name>myAgency</name>
<phone>123456</phone>
</agency>

_officesXML..agency.(@name == "NJ Agency")

return:

<agency name="NJ Agency">
<name>myAgency</name>
<phone>123456</phone>
</agency>

But i don't know node name 'agency' in this time. I need some like:


_officesXML..here_is_my_variable_with_value_for_example"agency". (@name
== "NJ Agency")

thanks,

pavel
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to