flex写的xml格式文件生成工具

package jiaoben
{
 import flash.net.URLVariables;
 
 import mx.rpc.http.HTTPService;
 public class HttpUtil
 {
  private  static var url:String;
  public function HttpUtil()
  {
  }
  
  public static function set Url(urlStr:String):void
  {
    url=urlStr;
  }
  public static function get Url():String
  {
    return url;
  }

   //以下是对httpService发送的再一次封装
   public static function  send(httpService:HTTPService,action:String,param:Object=null):void
         {
           httpService.method="POST";
           var uri:String=url+action;
           httpService.url=encodeURI(uri);
             var o:URLVariables=new URLVariables();
             if(param!=null)
             {
               o.userInfo=param;
             }
           httpService.send(o);
         }

       /*

        *@param labelName 定义的xml变量格式 eg:var userInfo:XML=<userInfo/>;

       *@param labelArr xml标记数组 eg: var arr:Array=["operator","userName","password"];

       *@param dataArr xml值数组  eg:var item:Array=["login",user_id.text,password_id.text];

        */
       public static function transfer(labelName:XML,labelArr:Array,dataArr:Array):XML
       {
         
              for(var i:int=0;i<labelArr.length;i++)
              {
               if(i<dataArr.length)
               {
                   labelName.appendChild("<"+labelArr[i]+">"+dataArr[i]+"</"+labelArr[i]+">");
               }else
               {
                   labelName.appendChild("<"+labelArr[i]+">0</"+labelArr[i]+">");
               }
               }
               return labelName;
       } 

 }
}

你可能感兴趣的:(xml,.net,Flex,Flash)