I ran into a similar problem when using xml data returned from a web 
service. You need to either use the wildcard namespace or declare 
and add one on to the result. I found it easier just to use the 
wildcard.

myCollection.*::source.*::trainingEvent.*::trainingEventInstance.*::
(@keyID == instanceID).parent()[EMAIL PROTECTED]; 

or something to that effect should do the trick

http://livedocs.macromedia.com/flex/2/docs/wwhelp/wwhimpl/js/html/wwh
elp.htm?href=00001918.html

Derrick Grigg
-------------
www.dgrigg.com

--- In [email protected], "Clare Todd" <[EMAIL PROTECTED]> 
wrote:
>
> I have a hunk of XML that I have loaded into an 
XMLListCollection.  It describes a training course catalog.  I'm 
trying to write a function to return the title of a course when 
passed the "KeyID" of a specific course instance, and am running 
into all sorts of problems (it ain't working being the worst of 
them).
> 
> Here's the XML:
> 
> <catalog>
> <trainingEvent keyID="1" title="Programming 101" 
eventCost="499.99">
> <trainingEventInstance keyID="1" trainingEventID="1" 
location="Houston" eventDate="02/11/2007" instanceCost="499.99" />
> <trainingEventInstance keyID="2" trainingEventID="1" 
location="Houston" eventDate="04/19/2007" instanceCost="499.99" />
> <trainingEventInstance keyID="3" trainingEventID="1" location="Las 
Vegas" eventDate="04/19/2007" instanceCost="299.99" />
> </trainingEvent>
> <trainingEvent keyID="2" title="Miter Saw Safety" 
eventCost="300.00">
> <trainingEventInstance keyID="4" trainingEventID="2" 
location="Houston" eventDate="12/25/2006" instanceCost="300.00" />
> </trainingEvent>
> </catalog>
> 
> ... it's loaded into an XMLListCollection called myCollection 
using HTTP service with resultFormat=e4x
> 
> I'm trying to ignore the trainingEventID attribute, since it might 
be going away.  I was trying to do some e4x magik to find the title 
like this, where the parameter is the KeyID of the 
trainingEventInstance:
> 
> public function getCourseTitle( instanceID:Number ):String {
>    return myCollection.source.trainingEvent.trainingEventInstance.
(@keyID == instanceID).parent()[EMAIL PROTECTED];
>   }
> 
> so when the function is passed 4, it returns "Miter Saw Safety"
> 
> Am I doing something wrong?  Can I not e4x using the "source" 
property?  Any thoughts?  Thanks!
>







--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/flexcoders/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to