Flowscript - delete file

Peter Sparkes <[email protected]>
Newsgroups gmane.text.xml.cocoon.user
Message-ID <[email protected]>
Hi,

I am trying to delete xml files using the following flowscript:

    function deletefile() {

         //file to be deleted
         var file = Packages.java.lang.String(cocoon.parameters["file"]);

         try {
             // creating a link to the file to be deleted
             var xml_file = Packages.java.io.File("D:\cocoon-2.1.11-wl\build\webapp\B&B\xml" + file
    + ".xml");

             //Delete file
             Packages.java.io.File.xml_file.delete();

             //  .txt file with OK message
             cocoon.sendPage("success.txt", null);
         }
         catch(ex){
             cocoon.log.error(ex);
             // Smth. went wrong. Sending a error.txt file to the browser
           cocoon.sendPage("error.txt", null);
         }

    }

and get "Compilation produced 1 syntax errors"

The error log contains:

    ERROR ............    deletefile.js", line 13: missing name after . operator

line 13 is:

    Packages.java.io.File.xml_file.delete();

What I am doing wrong?

Peter
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.