Most of the time we are facing difficulties in using the xml in data transfer object. So here is my simple solution for this problem. We can easily conver the xml into object with the use of simpleXMLDecoder. The only thing we have to do is just convert the xmlString into XMLDocument and pass this xmlDocument into the simpleXMLDecoder.
Here is how its works:
private function xmlConverter(xml:XML):ArrayCollection{
var xmlStr:String = xml.toString();
var xmlDoc:XMLDocument = new XMLDocument(xmlStr);
var decoder:SimpleXMLDecoder = new SimpleXMLDecoder(true);
var resultObj:Object = decoder.decodeXML(xmlDoc);
var ac:ArrayCollectin = new ArrayCollection();
ac = resultObj.Items.Item;
return ac;
}
This code have mistakes.
-> var xmlStr:String = event.result.toString.toString();
???????
Thanks rt, i have corrected the mistake..
Could you send me all source code or show it? Becouse is something wrong in event….
Apologize. I was preparing some document on this. while i create this post. so i didn’t realize. Thanks rt.
Actually this is quite good!! Easily parses xml into an object! nice
I would just change:
ac = resultObj.Items.Item;
as this is specific to the object returned…
cheers