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:flexcoders@yahoogroups.com] 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" <[EMAIL PROTECTED]> 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:flexcoders@yahoogroups.com] 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




SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




Reply via email to