Creating XML file on mobile device

Hello,

What is the correct method to create an XML on a mobile device (MC75A) so it can be transmitted via FTP? Here is my code that is not working. Thank you in advance for your assistance

  var destfile = "\\app\\transfer\_text.txt";
  var text = "";

  text = "<?xml version=\"1.0\" standalone=\"yes\" ?>\n" +
         "<data>\n" +
         " <code id=\"" + scaninfo + "\">\n" +
         "  <date>" + date + "</date>\n" +
         "  <hour>" + hour + "</hour>\n" +
         "  <minute>" + minute + "</minute>\n" +
          "  <notes>" + notes + "</notes>\n" +
         " </code>\n" +
         "</data>\n";

   try
     {
     var fso, s;
     fso = new ActiveXObject("Scripting.FileSystemObject");
     s = fso.OpenTextFile("C:\\cdm\\transfer\\Logfile.txt" , 8, true);
     s.writeline(text);
     s.Close();
     }
   catch(err)
     {
     var strErr = 'Error:';
     strErr += '\nNumber:' + err.number;
     strErr += '\nDescription:' + err.description;
     alert(strErr);
     }

Anonymous (not verified)
What application are you

What application are you using on your device to run the javascript?  What error does your program give?

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Darrell Ortiz
Hi Darryn,RHO, I am getting

Hi Darryn,

RHO, I am getting an unknown error number and description. Would legacy ODAX work to create XML file?

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Darryn Campbell
Hi,You say "fso = new

Hi,

You say "fso = new ActiveXObject("Scripting.FileSystemObject");" which will only run under Internet Explorer, RhoElements uses WebKit.  ODAX will not create XML files, it will only query existing ones.  You just need to create a file on the device, I'm not sure of the best way to do this via Javascript as I have not tried, looking around online there are several leads such as:

    set fso = CreateObject("Scripting.FileSystemObject"); 

    set s = fso.CreateTextFile("C:\test.txt", True);

    s.writeline("HI");

    s.writeline("Bye");

    s.writeline("-----------------------------");

    s.Close();

but I'm not sure if this is allowed under the security model... has anybody else tried this?

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Log in to post comments