Simple example of XML in Flex 1.5:

var yourXML:XML = XML(srv.result);
var topNodes_array:Array = yourXML.childNodes;
var topNodesLen:Number = topNodes_array.length;
while(topNodesLen--)
{
    var subNode:XMLNode = topNodes_array[topNodesLen];
    var subNodeAttribute:String = subNode.attributes.someval;
    trace("someval: " + subNodeAttribute);
}


----- Original Message ----- 
From: "papuss65" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Thursday, November 24, 2005 10:48 PM
Subject: [flexcoders] Looping through XML to get attributes values


Hi, am new to Flex and Actionscript and I am trying to get my head
around looping through XML attributes. Actionscript seems quite
complex when dealing with XML so I was hoping someone here could give
me a hand.

To begin with I would like to put the information in a Tree or DataGrid.

So far, I get my XML: 

 <mx:HTTPService id="srv" url=" { url }"
        resultFormat="xml"/>

then I can read/display

srv.result.childNodes[a].childNodes[b].attributes.Type

I want to be able to loop through [a] and [b] and get all the
attributes.ID as my column or tree nodes. I guess.. where to start..
is my problem. 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



 



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Get fast access to your favorite Yahoo! Groups. Make Yahoo! your home page
http://us.click.yahoo.com/dpRU5A/wUILAA/yQLSAA/nhFolB/TM
--------------------------------------------------------------------~-> 

--
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/

<*> 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