View Full Version : Converting DataGrid info back to XML
Hi,
I am new to this forum and have quite a few questiions, just so I can separate out my queries, i have started 2 different threads.
This one is about a dataGrid that i load dynamically using an XML. Along with the data being displayed there is a ComboBox that is dispalyed in the first column with every Row. A value from this ComboBox can be selected and then the data is submitted back to a WebService or a HTTP Service.
Now I have to send back the data in the dataGrid in the form of an XML. How can I do this?
Please shed some light on this.
Thanks.
flexy
05-14-2007, 11:16 AM
Someone was trying to do this a while back here: http://www.flexdeveloper.eu/forums/YaBB.pl?num=1170079627
Hey Flexy,
Thanks for getting back on this issue. I read the other thread that you had forwarded. but that thread doesn't seem to have a solution as such.
I just want this clarified, the xml data that is loaded into my DatGrid dataProvider CANNOT be modified and sent back to another webService. Is this correct?
dr_zeus
05-16-2007, 05:49 PM
Internally, the DataGrid converts your data to an XMLListCollection. If you think you can convert it back, go for it, but that's probably not the best way to do it. Instead, I would store the XML data in a variable outside the DataGrid and bind to that. If you have editors in the DataGrid, you can probably listen for events that will let you modify the external XML.
Thank you dr_zeus. So, atleast I know I am doing something right.
Instead, I would store the XML data in a variable outside the DataGrid and bind to that. If you have editors in the DataGrid, you can probably listen for events that will let you modify the external XML.
Ok, so let me explain what I am doing. I receive my response from a webservice and extract the lastResult object into a bindable XML type variable xmlResponse. Now the xml I receive is in the form:
<?xml version="1.0" ?>
<root>
<parent><child>xx</child></parent>
<parent><child>yy</child></parent>
<parent><child>zz</child></parent>
</root>
Into the dataGrid, I populate {xmlResponse.parent}. Now I also change the value of some of the child tags. Having done this I need to resend this in the form of an xml back to another web service. As I have been trying to do this for sometime now, I have made sure that changes being done to the dataGrid are getting saved into the original xml variable xmlResponse. So, right now I am trying to send the response back to a web service, where I am facing some problem. I made sure that the contentType is set to "application/xml" and this xmlResponse object is submitted back to the web service. I can see that the web service is getting invoked, but trying to view the xml data from the web service, tells me that it is blank. All the xml data is not to be seen. Can anyone please explain me why it is so??
Thank you very much everybody!! Finally figured it out. looks like the contentType of the HTTPService to which I was submitting my xml, had to be changed to "txt/xml" and also, I had to pass the XML as xmlResponse.toXMLString() . xmlResponse is the name of the XML type var in which I was storing all the xml data.
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.