The handling namespaces is not so difficult. Here is a nice example from Darron Schall http://www.darronschall.com/weblog/archives/000223.cfm. Also, direct from the source we have http://livedocs.adobe.com/flex/201/html/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Book_Parts&file=13_Working_with_XML_169_09.html
Note that you can use the * operator to use any namespace eg myXML.*::nodeName In your case this would be helpful, http://www.cameroontrader.com:8080/axis/services/ContactService?method=getContactshas a whacked and super silly namespace game going on. There is no need for a unique namespace for every node in your XML, eh? If there is, please correct me, I'll still say its silly though. I'll point out that in the code example below, the result is not using XML, rather nested Objects and Collections thereof. Use the resultFormat property set to xml or e4x for actual XML. See http://livedocs.adobe.com/flex/201/langref/XML.html for some great e4x examples too. e4x rawks. DK On Wed, Aug 20, 2008 at 1:29 PM, Gabsaga Tata <[EMAIL PROTECTED]> wrote: > Lucas, > > Thanks a lot for your help and the prompt response. It works like a charm > and that's exactly what I was looking for. > > Gabsaga > > > -----Original Message----- > *From:* Lucas Golden [mailto:[EMAIL PROTECTED] > *Sent:* Wednesday, August 20, 2008 11:49 AM > *To:* [email protected] > *Subject:* Re: [AFFUG Discuss] How to handle XML data with namespace > prefix? > > Hey Gabasaga, > > I would put the xml into an ArrayCollection and go from there. The > following is what I just cooked up and it seems to get the job done. I > don't know if you are trying to preserve the namespace prefixes or not. > > > > -------- > <?xml version="1.0" encoding="utf-8"?> > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" > layout="absolute" creationComplete="init();"> > > > <mx:Script> > <![CDATA[ > import mx.rpc.events.ResultEvent; > import mx.collections.ArrayCollection; > > [Bindable] > private var nsArray:ArrayCollection; > > public function init():void > { > namespaceXML.send(); > > } > > public function nsHandler(event:ResultEvent):void > { > nsArray = > event.result.Envelope.Body.getContactsResponse.getContactsReturn; > } > > ]]> > </mx:Script> > <mx:HTTPService url=" > http://www.cameroontrader.com:8080/axis/services/ContactService?method=getContacts" > id="namespaceXML" result="nsHandler(event)"/> > <mx:DataGrid x="79" y="126" width="580" height="284" > dataProvider="{nsArray}"> > <mx:columns> > <mx:DataGridColumn headerText="Contact ID" > dataField="contactId"/> > <mx:DataGridColumn headerText="Email Address" > dataField="emailAddress"/> > <mx:DataGridColumn headerText="First Name" > dataField="firstName"/> > <mx:DataGridColumn headerText="Last Name" > dataField="lastName"/> > <mx:DataGridColumn headerText="Phone Number" > dataField="phoneNumber"/> > > </mx:columns> > </mx:DataGrid> > > </mx:Application> > ---------- > > Hope that works for you! > Luke > > On Wed, Aug 20, 2008 at 11:27 AM, Gabsaga Tata <[EMAIL PROTECTED]>wrote: > >> The following web service call returns XML data with namespace prefix on >> every element. How do I handle this with Flex so I can display the data in a >> DataGrid? The examples that I have seen don't have the namespace prefix >> issue that I'm facing. >> >> >> http://www.cameroontrader.com:8080/axis/services/ContactService?method=getContacts >> >> I tried something like the following but it didn't work. >> >> >> <mx:DataGrid id="entries" width="{reader.width-15}" >> dataProvider="{httpServ.lastResult.getContactsResponse.getContactsReturn}"> >> </mx:DataGrid> >> >> Thanks. >> >> Gabsaga >> >> ------------------------------------------------------------- >> To unsubscribe from this list, simply email the list with unsubscribe in >> the subject line >> >> For more info, see http://www.affug.com >> Archive @ http://www.mail-archive.com/discussion%40affug.com/ >> List hosted by FusionLink <http://www.fusionlink.com/> >> ------------------------------------------------------------- > > > > ------------------------------------------------------------- > To unsubscribe from this list, simply email the list with unsubscribe in > the subject line > > For more info, see http://www.affug.com > Archive @ http://www.mail-archive.com/discussion%40affug.com/ > List hosted by FusionLink <http://www.fusionlink.com/> > ------------------------------------------------------------- > > > ------------------------------------------------------------- > To unsubscribe from this list, simply email the list with unsubscribe in > the subject line > > For more info, see http://www.affug.com > Archive @ http://www.mail-archive.com/discussion%40affug.com/ > List hosted by FusionLink <http://www.fusionlink.com> > ------------------------------------------------------------- > -- Douglas Knudsen http://www.cubicleman.com this is my signature, like it? ------------------------------------------------------------- To unsubscribe from this list, simply email the list with unsubscribe in the subject line For more info, see http://www.affug.com Archive @ http://www.mail-archive.com/discussion%40affug.com/ List hosted by http://www.fusionlink.com -------------------------------------------------------------
