<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" creationComplete="init ()"> <mx:Script> <![CDATA[ public function init ():void { var xml_object:XML = <Item xmlns="some.namespace.com"> <ItemID>110000579339</ItemID> <Site>US</Site> <Title>Halo 2 (Xbox)</Title> <Currency>USD</Currency> <SiteHostedPicture> <GalleryType>http://somesite.com/somepicture.jpg </GalleryType> </SiteHostedPicture> <PaymentMethods>PayPal</PaymentMethods> </Item>; // Get Default XML Namespace var item_ns:Namespace = xml_object.namespace (""); // Reference nodes using namespace prefix trace (String (xml_object..item_ns::Title)); } ]]> </mx:Script> </mx:Application>
--- In flexcoders@yahoogroups.com, "Sonja Duijvesteijn" <[EMAIL PROTECTED]> wrote: > > some_label.text=xml_object.ItemID.Title.toString(); > You want the Title from the ItemID not from the xml object. > > some_label.text=xml_object.(@xmlns=="...").ItemID; > I'm not sure why it thinks that @xmlns doesn't exists but it should be == as > it's not an assignment. > > Kind regards, > Sonja Duijvesteijn > > > 2006/6/7, Charles <[EMAIL PROTECTED]>: > > > > Hi everyone, > > > > > > > > This is a follow-up question from my last post < > > http://groups.yahoo.com/group/flexcoders/message/38691? threaded=1&var=1 >. > > I've managed to use an XML object instead of an XMLDocument object, so that > > I can utilize E4X to parse the XML. BUT, my new problem is that for some > > xml results that are returned, the tags have attributes, and now the calls > > to access the child nodes don't work anymore. For instance... > > > > > > > > var xml_object = <Item xmlns="some.namespace.com"> // Item tag now has > > attribute xmlns="..." > > <ItemID>110000579339</ItemID> > > <Site>US</Site> > > <Title>Halo 2 (Xbox)</Title> > > <Currency>USD</Currency> > > <SiteHostedPicture> > > <GalleryType>http://somesite.com/somepicture.jpg > > </GalleryType> > > </SiteHostedPicture> > > <PaymentMethods>PayPal</PaymentMethods> > > </Item> > > > > > > > > So, calls that used to work to access child nodes, such as > > some_label.text=xml_object.Title, which would return the items title, used > > to work but now they just display nothing...? I've tried using the @ > > attribute operator in calls such as > > some_label.text=xml_object.(@xmlns="...").ItemID, but still nothing (I > > actually get an error for that last call - undefined property 'xmlns'). So > > now I'm stuck until I can figure out how to access those child nodes with > > the attribute on there, or to somehow parse the XMl and remove the attribute > > before I try to access the child nodes. > > > > > > > > Thanks in advance > > > > > > > > > > > > Charles > > > > > > > ------------------------ Yahoo! Groups Sponsor --------------------~--> Everything you need is one click away. Make Yahoo! your home page now. http://us.click.yahoo.com/AHchtC/4FxNAA/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/