Return-Path: X-Original-To: apmail-cocoon-users-archive@www.apache.org Delivered-To: apmail-cocoon-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4ACF8E7DA for ; Thu, 27 Dec 2012 09:29:08 +0000 (UTC) Received: (qmail 14450 invoked by uid 500); 27 Dec 2012 09:29:07 -0000 Delivered-To: apmail-cocoon-users-archive@cocoon.apache.org Received: (qmail 14124 invoked by uid 500); 27 Dec 2012 09:29:07 -0000 Mailing-List: contact users-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: users@cocoon.apache.org List-Id: Delivered-To: mailing list users@cocoon.apache.org Received: (qmail 14098 invoked by uid 99); 27 Dec 2012 09:29:06 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 27 Dec 2012 09:29:06 +0000 X-ASF-Spam-Status: No, hits=2.9 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [212.50.160.34] (HELO smtpout.karoo.kcom.com) (212.50.160.34) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 27 Dec 2012 09:28:55 +0000 X-IronPort-AV: E=Sophos;i="4.84,361,1355097600"; d="scan'208,217";a="692815219" Received: from unknown (HELO [192.168.0.2]) ([109.176.186.248]) by smtpout.karoo.kcom.com with ESMTP; 27 Dec 2012 09:28:30 +0000 Message-ID: <50DC14BF.8070005@didm.co.uk> Date: Thu, 27 Dec 2012 09:28:31 +0000 From: Peter Sparkes Reply-To: peter@didm.co.uk User-Agent: Mozilla/5.0 (Windows NT 6.0; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: users@cocoon.apache.org Subject: Flowscript - delete file Content-Type: multipart/alternative; boundary="------------020609040107030205040301" X-Virus-Checked: Checked by ClamAV on apache.org --------------020609040107030205040301 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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 --------------020609040107030205040301 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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

--------------020609040107030205040301--