flex SimpleXMLEncoder_SimpleXMLDecoder

private function singleXMLEncoder():void{
				var obj:Object=new Object;
				obj.name="admin";
				obj.pasword="password";
				var qName:QName=new QName("http://www.kangkang.com","hello");
				var xmlNode:XMLNode=new XMLNode(3,"value");
				//qName.localName="str";
				//qName.uri="http://www.kangkang.com";
				var ms:SimpleXMLEncoder=new SimpleXMLEncoder(null);
				var newxmlNode:XMLNode=ms.encodeValue(obj,qName,xmlNode);
				trace(newxmlNode.toString()); //<hello><name>admin</name><pasword>password</pasword></hello>
				var str:SimpleXMLDecoder=new SimpleXMLDecoder();
				var decoderobj:Object=str.decodeXML(newxmlNode);
				trace(decoderobj.name); //admin
				
			}
 

你可能感兴趣的:(Flex)