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