Yeah well, this wasn't the important thing, but the syntax with the
wildcard.

The best would be:
_officesXML..*.(attribute(name) == "NJ Agency")

It will search in everything and won't throw an error if the property name
doesn't exist.

If the name is not unique, it will a problem though, or you will have to
test the length() of the result and make action with it if more than 1.

Romu
www.soundstep.com


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

I don't think that will not work unless every single node in the XML has 
the attribute called "name".

hasOwnProperty("@name") checks if the node has the attribute.

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

Romuald Quantin wrote:
> This will search through everything if you need:
> 
> _officesXML..*.(@name == "NJ Agency")
> 
> Romu
> www.soundstep.com
> 
> 
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of
Christoffer
> Enedahl
> Sent: 09 July 2008 15:51
> To: Flash Coders List
> Subject: Re: [Flashcoders] variable in e4x filtering
> 
> oh sorry, email code. it got a dot too much, here this works:
> _officesXML[ nodeName ].(@name == "NJ Agency")
> 
> Pavel Kru*šek skrev:
>> 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