1 Reply Latest reply on Sep 10, 2013 5:19 AM by Harbs.

    Modify the idms file in CS Extension

    Mac_06 Level 2

      I'm modifying/updating the xml attribute of .idms file. using actionscript. I'm using below approach to do that.

       

      protected function windowedapplication1_creationCompleteHandler(event:FlexEvent):void
         {
          var file:File = File.desktopDirectory.resolvePath('myInputFile.xml');
          var fileStream:FileStream = new FileStream();
          fileStream.open(file, FileMode.READ);// doesn't read processing instrunction
          var xml:XML = new XML(fileStream.readUTFBytes(fileStream.bytesAvailable));
          fileStream.close();
          var writeStream:FileStream =  new FileStream();
          writeStream.open(file, FileMode.WRITE);
          for each(var node:XML in xml.descendants("*"))
          {
           if(node.localName() == "Link")
           { 
            var linkfile:String=node.@LinkResourceURI = "file:/Shared/Logos/Bk.ai";
           }
          }
          writeStream.writeUTFBytes(String(xml));
          writeStream.close();
          
         }
      
      

          In above code problem is that it does not read processing instruction on top of xml file. in result after writing the xml file, it won't read the file as InDesign snippet file anymore and treat it that as simple xml.
      Processing instrunctions are:

       

       

      <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
      <?aid style="50" type="snippet" readerVersion="6.0" featureSet="257" product="8.0(370)" ?>
      <?aid SnippetType="PageItem"?>
          
      

      Can anyone help me in figure out how I can I read the processing instrunction as well in new file ?