Encode an ActionScript Data Object as XML
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical">
<mx:Canvas width="400" height="300" creationComplete="init()">
<mx:Script>
import mx.rpc.xml.SimpleXMLEncoder;
private var o:Object = {name:"A",description_items:{height:'183cm', weight:'77k'}};
private var doc:XMLDocument;
private function init():void {
doc = new XMLDocument('<data></data>');
var simpleEncode:SimpleXMLEncoder = new SimpleXMLEncoder(doc);
var node:XMLNode = simpleEncode.encodeValue(o, new QName('http://localhost/ws', 'ls'), doc.firstChild);
}
</mx:Script>
</mx:Canvas>
</mx:Application>
Related examples in the same category