I may agree with you, but in that case, how do you explain that the
demo code from the "restaurant" sample application works: 

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml";>
<mx:HTTPService id="srv" url="restaurantlist.jsp" resultFormat="xml"/>
<mx:Button label="Get data" click="srv.send()"/>
<mx:DataGrid id="dg" dataProvider="{srv.result.list.restaurant}"
width="100%" height="100%"/>
</mx:Application>

The XML returned by the servlet is like:

<?xml version="1.0" encoding="utf-8"?>
<list>

<restaurant>
<name>Addis Red Sea</name>
<address>544 Tremont St</address>
<city>Boston</city>
<zip></zip>

<phone>(617) 426-8727</phone>
<description>test</description>
<image>addis.jpg</image>
<link>http://www.addisredsea.com</link>
<mapX>375.0</mapX>
<mapY>291.0</mapY>

<review>Addis Red Sea is one of Boston's only authentic
Ethiopian restaurants. We are proud to offer traditional Ethiopian
cuisine in a warm and friendly environment.</review>
</restaurant>


This is really confusing, dont you think ?


--- In [email protected], Matt Chotin <[EMAIL PROTECTED]> wrote:
> The List classes can't handle XML, they take arrays of objects. 
When you
> had resultFormat="xml" you were passing in something that couldn't be
> handled.
> 
> 
> 
> Matt
> 
> 
> 
> _____ 
> 
> From: jivankohinoor [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, March 03, 2005 2:51 PM
> To: [email protected]
> Subject: [flexcoders] Re: datagrid does not display http data
> 
> 
> 
> 
> Thanks a lot, it was the right idea.
> Actually, your piece of code does not compile, but I wrote the
> following that works :
> 
> <mx:HTTPService id="catalogContents" contentType="application/xml"
> method="GET" protocol="http" 
> url="http://localhost:8080/protocore/getCatalogContents
> <http://localhost:8080/protocore/getCatalogContents> " 
> result="setGridData(event.result)" resultFormat="object"/>
> 
> <mx:Script>
> var gridData:Object ;
> function setGridData(o)
> {
> gridData = o ;
> }
> </mx:Script>
> 
> <mx:DataGrid id="catalogGrid" height="100%" width="100%"
> dataProvider="{gridData.elements.element}">
> 
> I am still confused why my first method did not work, as I found the
> same code in samples applications, like the "restaurants" one:
> 
> <mx:HttpService id="srv" url="restaurantlist.jsp"/>
> <mx:DataGrid dataProvider="{srv.result.list.restaurant}"/>
> 
> I tried the previous code, and it works fine.
> with my XML data, it does not work !!! even with small file.
> I'd like to understand...
> 
> --- In [email protected], "Robert Brueckmann"
> <[EMAIL PROTECTED]> wrote:
> > Instead of creating an alert with the result attribute of the
> > HTTPService request, make a call to a method that would set the
> > dataprovider to the resulting XML.
> > 
> > 
> > 
> > The problem is, when the datagrid is created, the XML from the
> > HTTPService isn't ready yet, so you need to reset the dataprovider of
> > the datagrid once the XML is actually returned. So try something
like:
> > 
> > 
> > 
> > <mx:HTTPService id="catalogContents" contentType="application/xml"
> > method="GET" protocol="http" resultFormat="xml" 
> > url="http://localhost:8080/protocore/getCatalogContents
> <http://localhost:8080/protocore/getCatalogContents> "
> > fault='alert(event.fault.faultstring,"",mx.controls.Alert.OK)'
> > result="setData(event.result);" resultFormat="object">
> > 
> > 
> > 
> > <mx:Script>
> > 
> > public function setDate(result:Object) {
> > 
> > catalogGrid.dataProvider = result.element;
> > 
> > }
> > 
> > </mx:Script>
> > 
> > <mx:DataGrid id="catalogGrid" height="100%" width="100%"
> > dataProvider="{catalogContents.result.element}">
> > ...
> > 
> > 
> > 
> > Not sure if that code will actually work but that's the general
gist of
> > it.
> > 
> > 
> > 
> > Robert L. Brueckmann
> > 
> > Web Developer
> > 
> > Merlin Securities, LLC
> > 
> > 595 Madison Avenue
> > 
> > New York, NY 10022
> > 
> > p: 212.822.4821
> > f: 212.822.4820
> > 
> > ________________________________
> > 
> > From: jivankohinoor [mailto:[EMAIL PROTECTED] 
> > Sent: Wednesday, March 02, 2005 10:18 AM
> > To: [email protected]
> > Subject: [flexcoders] datagrid does not display http data
> > 
> > 
> > 
> > 
> > I try to fill a DataGrid from live XML data over http, but the grid
> > desperately stays empty.
> > The code is :
> > 
> > <mx:HTTPService id="catalogContents" contentType="application/xml"
> > method="GET" protocol="http" resultFormat="xml" 
> > url="http://localhost:8080/protocore/getCatalogContents
> <http://localhost:8080/protocore/getCatalogContents> "
> > fault='alert(event.fault.faultstring,"",mx.controls.Alert.OK)'
> > result='alert("Catalog OK","",mx.controls.Alert.OK)'>
> > 
> > <mx:DataGrid id="catalogGrid" height="100%" width="100%"
> > dataProvider="{catalogContents.result.element}">
> > 
> > 
> > Returned XML is like :
> > <?xml version="1.0" encoding="utf-8"?>
> > <elements>
> > <element Key="Key" Name="Name" Dir="Dir" lang="lang" nloc="nloc"
> > npar="npar" UNKNOWN1="UNKNOWN1" UNKNOWN2="UNKNOWN2" Status="Status"
> > Anom="Anom" label="label0" />
> > <element Key="BAT000000" Name="COA034" Dir="A1/PRG" lang="Cobol"
> > nloc="944" npar="649" UNKNOWN1="58" UNKNOWN2="" Status="CORRECT"
> > Anom="OK" label="label1" />
> > <element ...>
> > </elements>
> > 
> > I know that the Server part is OK, as I am able to display raw XML
> > code in the following TextArea:
> > <mx:TextArea text="{catalogContents.result}"/>
> > 
> > I tried the same, with XML compiled statically, and it works :
> > 
> > <mx:Model id="catalogContentsModel"
> > ource="D:\\src\\Flex\\Phoenix-proto\\cataloContents.xml" />
> > 
> > <mx:DataGrid id="catalogGrid"
> > dataProvider="{catalogContentsModel.result.element}">
> > 
> > Help would be greatly needed, I tried many different combinations of
> > returned XML without success (like returning <mx:Array>/<mx:Object>
> > tags, specifying the object attributes as XML attributes or as XML
> > elements, nothing work)
> > 
> > Am I *really* an idiot as I seem to be the only one with this problem.
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > Yahoo! Groups Sponsor
> > 
> > ADVERTISEMENT
> > click here
> >
<http://us.ard.yahoo.com/SIG=12934rmae/M=298184.6018725.7038619.3001176/
>
<http://us.ard.yahoo.com/SIG=12934rmae/M=298184.6018725.7038619.3001176/> 
> >
D=groups/S=1705007207:HM/EXP=1109863127/A=2593423/R=0/SIG=11el9gslf/*htt
> > p:/www.netflix.com/Default?mqso=60190075> 
> > 
> > 
> >
<http://us.adserver.yahoo.com/l?M=298184.6018725.7038619.3001176/D=group
>
<http://us.adserver.yahoo.com/l?M=298184.6018725.7038619.3001176/D=group> 
> > s/S=:HM/A=2593423/rand=585444464> 
> > 
> > 
> > 
> > ________________________________
> > 
> > Yahoo! Groups Links
> > 
> > * To visit your group on the web, go to:
> > http://groups.yahoo.com/group/flexcoders/
> <http://groups.yahoo.com/group/flexcoders/> 
> > 
> > * To unsubscribe from this group, send an email to:
> > [EMAIL PROTECTED]
> > <mailto:[EMAIL PROTECTED]> 
> > 
> > * Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> > Service <http://docs.yahoo.com/info/terms/
> <http://docs.yahoo.com/info/terms/> > .
> > 
> > --------------------------------------------------------
> > 
> > This message contains information from Merlin Securities, LLC, or
> from one of its affiliates, that may be confidential and privileged.
> If you are not an intended recipient, please refrain from any
> disclosure, copying, distribution or use of this information and note
> that such actions are prohibited. If you have received this
> transmission in error, please notify the sender immediately by
> telephone or by replying to this transmission.
> > 
> > Merlin Securities, LLC is a registered broker-dealer. Services
> offered through Merlin Securities, LLC are not insured by the FDIC or
> any other Federal Government Agency, are not deposits of or guaranteed
> by Merlin Securities, LLC and may lose value. Nothing in this
> communication shall constitute a solicitation or recommendation to buy
> or sell a particular security.
> 
> 
> 
> 
> 
> 
> 
> 
> Yahoo! Groups Sponsor
> 
> 
> 
> ADVERTISEMENT
> 
>
<http://us.ard.yahoo.com/SIG=129nvldto/M=298184.6018725.7038619.3001176/D=gr
>
oups/S=1705007207:HM/EXP=1109966066/A=2593423/R=0/SIG=11el9gslf/*http:/www.n
> etflix.com/Default?mqso=60190075> click here
> 
> 
> 
>
<http://us.adserver.yahoo.com/l?M=298184.6018725.7038619.3001176/D=groups/S=
> :HM/A=2593423/rand=378259094> 
> 
> 
> 
> _____ 
> 
> Yahoo! Groups Links
> 
> *     To visit your group on the web, go to:
> http://groups.yahoo.com/group/flexcoders/
> <http://groups.yahoo.com/group/flexcoders/> 
> 
> *     To unsubscribe from this group, send an email to:
> [EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]> 
> 
> *     Your use of Yahoo! Groups is subject to the Yahoo!
> <http://docs.yahoo.com/info/terms/> Terms of Service.





Reply via email to