I am concerned about this expression:

ordMedXMLList = resultXML.child("OrdMedList");

 

Why not:

ordMedXMLList = resultXML.OrdMed;  //You'll need the namespace
identifier in there or have a default.

trace(ordMedXMLList.length()); 

 

Tracy

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of ben.clinkinbeard
Sent: Tuesday, November 13, 2007 1:38 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: DataGrid not populating from XMLListCollection
- namespace issue?

 

Hi Brian,

These days I usually want to end up with strongly typed objects, so I
generally implement my VO classes so that they accept XML in their
constructor. I pass the XML node to the constructor, throw a "use
namespace" in there and then grab the properties I need from the XML.

HTH,
Ben

--- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
, "Brian" <[EMAIL PROTECTED]> wrote:
>
> Thanks! I've tried it and am still having problems. Sorry for the
> newbie questions.
> 
> You mentioned in the comments on your blog that you like to leave the
> resultFormat defaulted to Object. So then how do you construct your
> dataProvider? I'm confused because on one hand we're talking about
> handling XML/namespace data, but then you talk about leaving it as an
> Object. Do you still use a result Handler to parse your Object data
> into a different model?
> 
> --- In flexcoders@yahoogroups.com
<mailto:flexcoders%40yahoogroups.com> , "ben.clinkinbeard"
> <ben.clinkinbeard@> wrote:
> >
> > This might help, hope it does.
> >
>
http://www.returnundefined.com/2006/07/datagrid-labelfunction-and-namesp
aces/
<http://www.returnundefined.com/2006/07/datagrid-labelfunction-and-names
paces/> 
> > 
> > 
> > 
> > --- In flexcoders@yahoogroups.com
<mailto:flexcoders%40yahoogroups.com> , "Brian" <briforge@> wrote:
> > >
> > > I've been trying to get a DataGrid populated from a WebService and
> > > having much trouble. I'm wondering if the issue might be namespace
> > > issues, but I'm confused by the usage and syntax of namespace
from the
> > > posts I've found here on that. There is no data in the DataGrid,
but
> > > it does appear to flicker and slightly resize it self when I
call the
> > > service so it looks like _something_ is going on. I've bound the
> > > service response to an XMLListCollection so I can trace() it and
I can
> > > see the XML tree that should be displayed in the DataGrid.
> > > 
> > > Any ideas why it's not working? Would appreciate any help, been
> > > banging my head on this for days now. Thanks.
> > > 
> > > Here is the mxml :
> > > 
> > > <?xml version="1.0" encoding="utf-8"?>
> > > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml
<http://www.adobe.com/2006/mxml> "
> > > layout="absolute">
> > > 
> > > <mx:Script>
> > > <![CDATA[
> > > import mx.collections.XMLListCollection;
> > > import mx.controls.Alert;
> > > import mx.rpc.events.ResultEvent;
> > > private namespace ovServices = "http://services.company.com
<http://services.company.com> ";
> > > use namespace ovServices;
> > > [Bindable]
> > > public var ordMedList:XMLListCollection;
> > > public var ordMedXMLList:XMLList;
> > > 
> > > public function handleOrdMedSearch(event:ResultEvent):void {
> > > trace("handling OrdMedSearchResult");
> > > var resultXML:XML = XML(event.result);
> > > ordMedXMLList = resultXML.child("OrdMedList");
> > > //trace("ordMedList : " + ordMedList);
> > > ordMedList = new XMLListCollection(ordMedXMLList);
> > > }
> > > ]]>
> > > </mx:Script>
> > > 
> > > <mx:WebService id="ordMedSearchWS"
> > > 
wsdl="http://localhost:8080/OrderViewWeb/services/OrderableMed?wsdl
<http://localhost:8080/OrderViewWeb/services/OrderableMed?wsdl> "
> > > showBusyCursor="true">
> > > <mx:operation name="searchStartsWith" resultFormat="e4x"
> > > result="handleOrdMedSearch(event)">
> > > <mx:request>
> > > <searchText>{ordMedSearchText.text}</searchText>
> > > </mx:request>
> > > </mx:operation>
> > > </mx:WebService>
> > > 
> > > <mx:HBox x="10" y="70">
> > > <mx:Label text="Orderable Med Search" />
> > > <mx:TextInput id="ordMedSearchText" width="100"/>
> > > <mx:Button label="Search"
> > > click="ordMedSearchWS.searchStartsWith.send()"/>
> > > <mx:Label />
> > > </mx:HBox>
> > > 
> > > <mx:DataGrid x="10" y="100" id="ordMeds" width="400"
> > > dataProvider="{ordMedList}">
> > > <mx:columns>
> > > <mx:DataGridColumn headerText="Id" dataField="id" width="100"/>
> > > <mx:DataGridColumn headerText="Desc" dataField="desc" />
> > > </mx:columns>
> > > </mx:DataGrid>
> > > 
> > > </mx:Application>
> > > 
> > > Here is the xml from the trace : 
> > > 
> > > <OrdMedList xmlns:ns1="http://services.company.com/
<http://services.company.com/> "
> > > xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/
<http://schemas.xmlsoap.org/soap/envelope/> ">
> > > <ns2:OrdMed xmlns:ns2="http://services.company.com
<http://services.company.com> ">
> > > <ns2:desc xmlns="http://services.company.com
<http://services.company.com> ">tylenol</ns2:desc>
> > > <ns2:id xmlns="http://services.company.com
<http://services.company.com> ">7607</ns2:id>
> > > </ns2:OrdMed>
> > > <ns2:OrdMed xmlns:ns2="http://services.company.com
<http://services.company.com> ">
> > > <ns2:desc xmlns="http://services.company.com
<http://services.company.com> ">aspirin</ns2:desc>
> > > <ns2:id xmlns="http://services.company.com
<http://services.company.com> ">7608</ns2:id>
> > > </ns2:OrdMed>
> > > <ns2:OrdMed xmlns:ns2="http://services.company.com
<http://services.company.com> ">
> > > <ns2:desc
xmlns="http://services.company.com <http://services.company.com>
">ibuprofen</ns2:desc>
> > > <ns2:id xmlns="http://services.company.com
<http://services.company.com> ">7609</ns2:id>
> > > </ns2:OrdMed>
> > > </OrdMedList>
> > >
> >
>

 

Reply via email to