3 Replies Latest reply on Aug 27, 2008 1:10 AM by eiral

    xml config parsing problem


      i've got a problem when i try to parse the xml config file in the application directory.
      i'm trying to make a class to update my application if necessary. for that i parse the config file to see which version the user have. Then i parse an other xml file on a web server and if the version differ, i update the user application with the new one.

      the problem is : when i parse the user config xml, i've got nothing ! but the xml file is well parsed...
      here some part of my code :

      public function checkUpdate():void
      var loader:URLLoader = new URLLoader();
      loader.addEventListener(Event.COMPLETE, readVersion);
      loader.addEventListener(IOErrorEvent.IO_ERROR, localError);

      var request:URLRequest = new URLRequest(File.applicationDirectory.resolvePath(xmlFile).url);
      loader.dataFormat = URLLoaderDataFormat.TEXT

      private function readVersion(event:Event):void
      var localload:URLLoader = URLLoader(event.target);
      XML.ignoreComments = true;

      parser = XML(localload.data);
      trace("local version: " + parser.version);

      private var parser:XML;
      private var xmlFile:String;

      and here is the result in the console :

      local version:

      <application xmlns=" http://ns.adobe.com/air/application/1.0">

      we can see that the file is well parsed, but i've got nothing inside parser.version :(

      the most strange is when i change the xml file it works !
      same code, different xml file (in the same directory) :

      local version: 1


      here i got the version ..

      please help !