This worked for me:
 
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; 
 layout="vertical" creationComplete="ws.send()">
<mx:HTTPService id="ws"
url="http://ws.audioscrobbler.com/1.0/user/interactivenyc/friends.xml";
resultFormat="e4x" result="trace(ws.lastResult.toXMLString());
dg.dataProvider = ws.lastResult.user" />
<mx:DataGrid id="dg">
<mx:columns>
 <mx:DataGridColumn dataField="@username" />
</mx:columns>
</mx:DataGrid>
</mx:Application>


________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Steve Warren
Sent: Wednesday, September 26, 2007 7:54 AM
To: [email protected]
Subject: RE: [flexcoders] XML and ArrayCollections problem



Positive.  In fact, I was looking at the XML object in the debugger and
there were no references to the <user...> blocks at all!  Could this be
a bug in Flex?  I think I can send attachments, so hopefully there's a
small screenshot that shows what I'm seeing in the event object.

I'm getting this XML from LastFM.  If you want to check it out yourself,
here's the URL.

http://ws.audioscrobbler.com/1.0/user/interactivenyc/friends.xml

One fix for this would be to ask Last.FM to change this:

            <friends user="interactivenyc">

to this:

            <friends username="interactivenyc">

so that there's no conflict between the user property and the following
user blocks.  That would also be consistent with the <user
username="cassidyvoice"> style.

I could also treat the XML as a string and splice out the user property,
but figure there must be a better way to handle this with the built in
XML tools.

-steve warren

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Alex Harui
Sent: Tuesday, September 25, 2007 8:13 PM
To: [email protected]
Subject: RE: [flexcoders] XML and ArrayCollections problem

You sure you didn't accidentally use '[EMAIL PROTECTED]' instead of
'friends.user'?

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Steve Warren
Sent: Tuesday, September 25, 2007 12:53 PM
To: [email protected]
Subject: RE: [flexcoders] XML and ArrayCollections problem

I tried using XMLListCollection, but have the same problem. Is there an
alternate syntax I can use to refer to the "users" blocks inside my
"friends" block, rather than the "users" property of the "friends"
block?

-s

--- In [email protected] <mailto:flexcoders%40yahoogroups.com>
, "Alex Harui" <[EMAIL PROTECTED]> wrote:
>
> xmllistcollection
> 
> ________________________________
> 
> From: [email protected] <mailto:flexcoders%40yahoogroups.com>
[mailto:[email protected] <mailto:flexcoders%40yahoogroups.com>
] On
> Behalf Of Steve Warren
> Sent: Monday, September 24, 2007 2:20 PM
> To: [email protected] <mailto:flexcoders%40yahoogroups.com> 
> Subject: [flexcoders] XML and ArrayCollections problem
> 
> 
> 
> Hey Flexcoders,
> 
> I'm starting to learn Flex, coming from a Flash background, trying to
> wrap
> my head around the new ways to deal with XML. I'm trying to set a
> dataProvider for a DataGrid component to an ArrayCollection. Problem
is,
> the XML I'm getting back from my service looks like this:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <friends user="me">
> <user username="friend1" />
> <user username="friend2" />
> [...]
> 
> When I try to set my ArrayCollection to event.result.friends.user,
it's
> finding the String "me" instead of the array of users I'm looking for.
> 
> Is there another way to get at this data?
> 
> Thanks in advance for any advice.
> 
> -steve
>

 

Reply via email to