Werner, thanks for your input again. I've decided to go back to using the old style XML object (now called XMLDocument).
the XMLDocument.attributes() method returns an 'associative array' a bit like a hashtable. So in my case <Node1 a='b' c='d' e='f'/> XMLDocument.attributes() gives pos : value a : b c : d e : f whereas XML.attributes() gives pos : value 0 : b 1 : d 2 : f please correct me if i'm wrong anyone. --- In flexcoders@yahoogroups.com, "Werner Sharp" <[EMAIL PROTECTED]> wrote: > > Hmm, that works for me. You could also try... > > > > for each (var a:Object in xml1.attributes()) > > { > > ... > > } > > > > Or use a for loop... > > > > var xl:XMLList = xml1.attributes(); > > for (var i:int = 0; i < xl.length(); i++) > > { > > trace (xl[0].toXMLString(); > > // or try typeof, nodeKind(), etc. > > } > > > > > > ________________________________ > > From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On > Behalf Of bhaq1972 > Sent: Tuesday, April 11, 2006 1:40 AM > To: flexcoders@yahoogroups.com > Subject: [flexcoders] Re: Flex2B2 simple question regarding xml > attributes > > > > i did the following > for each (var a:Object in [EMAIL PROTECTED]) > { > trace (a.name()); > trace (a.toXMLString()); > } > a.name doesn't trace anything. a.toXMLString() traces the attribute > value. so we're half way their. > > > > --- In flexcoders@yahoogroups.com, "bhaq1972" <mbhaque@> wrote: > > > > Hi Werner. Thanks the suggestion. I wasn't able to run this > because > > i'm getting a "access to undefined property 'a'" compile error > > > > > > --- In flexcoders@yahoogroups.com, "Werner Sharp" <wsharp@> wrote: > > > > > > How about this... > > > > > > > > > > > > var xml1:XML = <Node1 a='b' c='d' e='f' g='h'/> > > > > > > > > > > > > for each (a in [EMAIL PROTECTED]) > > > > > > { > > > > > > trace (a.name()); > > > > > > trace (a.toXMLString()); > > > > > > } > > > > > > > > > > > > > > > > > > ________________________________ > > > > > > From: flexcoders@yahoogroups.com > > [mailto:[EMAIL PROTECTED] On > > > Behalf Of bhaq1972 > > > Sent: Monday, April 10, 2006 8:31 AM > > > To: flexcoders@yahoogroups.com > > > Subject: [flexcoders] Flex2B2 simple question regarding xml > > attributes > > > > > > > > > > > > i can't find what i'm looking for in the docs. i need help > > > > > > All i want to do is iterate over an xml node's attributes. > > > > > > XML.attributes() returns a list of all the attributes, but this > is > > > only half of what i want. i want the attribute names as well. > > > > > > var xml1:XML = <Node1 a='b' c='d' e='f' g='h'/> > > > > > > i want the value 'a' and 'b' and 'c' and 'd' etc via a loop > > > > > > regards > > > bod > > > > > > > > > > > > > > > > > > > > > -- > > > 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 > > > > > > > > > > > > * Visit your group "flexcoders > > > <http://groups.yahoo.com/group/flexcoders> " on the web. > > > > > > * To unsubscribe from this group, send an email to: > > > [EMAIL PROTECTED] > > > <mailto:[EMAIL PROTECTED] > > subject=Unsubscribe> > > > > > > * Your use of Yahoo! Groups is subject to the Yahoo! Terms of > > > Service <http://docs.yahoo.com/info/terms/> . > > > > > > > > > > > > ________________________________ > > > > > > > > > > > > > -- > 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 > > > > * Visit your group "flexcoders > <http://groups.yahoo.com/group/flexcoders> " on the web. > > * To unsubscribe from this group, send an email to: > [EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED] subject=Unsubscribe> > > * Your use of Yahoo! Groups is subject to the Yahoo! Terms of > Service <http://docs.yahoo.com/info/terms/> . > > > > ________________________________ > -- 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/