0 Replies Latest reply on Mar 4, 2008 10:00 AM by alejandro52

    External xml Read/Write

    alejandro52 Level 1
      How is it possible to write or read specific nodes of an external xml without updating the whole external file?I have an external xml in witch i keep product info.But the problem is that when i want to change a product's price for example, I have to rewrite the whole external xml. The way i'm doing it is the following.
      First i take a copy of the external xml and keep it inside my program.
      var file:File = File.documentsDirectory.resolvePath("xml/myXML.xml");
      stream = new FileStream();
      stream.open(file,FileMode.UPDATE);
      all_data = new XML(stream.readUTFBytes(stream.bytesAvailable));
      stream.close();
      Then when i want to save any changes i've made to my xml i call a function
      public function saveData():void{
      var file:File = File.documentsDirectory.resolvePath("xml/myXML.xml");
      stream = new FileStream();
      stream.open(file,FileMode.WRITE);
      stream.writeUTFBytes(all_data.toXMLString());
      stream.close();
      }
      But my xml is really big the proccess of writing any changes is really stupid.How is it possible to write to specific places of the external xml, or see it as an xml and not as a bunch of bytes.