1 Reply Latest reply on Oct 4, 2013 10:46 AM by absqua

    Writing XML Object to a File

    frameexpert Level 4

      Hi, I am using InDesign JavaScript to make an XML object in memory. When my script is done, I want to write the XML to a file. When I run the code below, the file is created, but the XML is not written to the file. Any help would be appreciated. Thanks. Rick

       

      #target indesign
      
      var partsMap = <partsMap />;
      savePartsMap (partsMap);
      
      function savePartsMap (partsMap) {
          
          var partsFile;
          
          // Make a File object for the parts map XML file.
          partsFile = new File("E:\\Test.xml");
          // Open the map file.
          partsFile.open("w");
          partsFile.write(partsMap);
          partsFile.close();
      }