Pages: [1] 2
  Print  
Author Topic: Kunerlite and XML  (Read 12373 times)
0 Members and 1 Guest are viewing this topic.
kiranrprabhu
Newbie
*
Posts: 15


« on: 26 May , 2008, 06:02:19 »

I was trying an simple Database appliction in Flashlite and Kunerilite where the records are stored in XML files in the mobile in the following format:

<contacts>
  <cont>
    <id></id>
    <name></name>
    <age></age>
    <email></email>
  </cont>
  <cont>
    <id></id>
    <name></name>
    <age></age>
    <email></email>
  </cont>
<contacts>

I am was able to read any number of records from the xml file but while adding records into the XML, I am not able to add more than 5 records. The moment I add 6th record, the application quits.

In the emulator, there is no such problem and the record gets added into the xml file.

Can anyone help me out to solve this problem?
Logged
KL Admin
Moderator
Sr. Member
*****
Posts: 313


« Reply #1 on: 26 May , 2008, 07:32:19 »

Hi Kiran and welcome to the forum!

Not sure of the problem yet, would you describe more of:
- Player version
- Phone model
- Have you installed latest patches from wiki.kunerilite.net?
- Does XML implementation work with standalone player?

cheers,
Jukka
Logged
kiranrprabhu
Newbie
*
Posts: 15


« Reply #2 on: 26 May , 2008, 22:42:47 »

Flashlite 2.0
Testing on Nokia E51
Kunerilite Plugins : File

I have created a simple Standalone database application where the data is stored in the device in the form of XML. (sample structure of xml is already posted).

The logic goes something like this...

The xml files are stored on the device at the time of installation.
I am reading the XML contents into the XML object (load method) and storing the contents in the multidimensional array.
The user can manipulate the contents of the array (Adding, modifying etc.) and then, when user selects the Save option, I am updating he entire array contents into the xml object.
Finally I am writing the XML object in the xml file using Kunerilite File plugin (write).

The above logic works fine till the data does not exceed 700 bytes. Once the data exceeds 700-800 bytes, the application quits in the device.

I tried converting the XML object into string but the result was the same.

However, in the emulator it works perfectly for any number of data.

Earlier I mentioned that I am unable to write more than 6 records int the xml file. I figured it out later that it is not the number of records, but the bytes occupied by the XML object (700-800) that is forcing the application to quit.

You suggested to install patches for Kunerilite. I did that but SIS was not getting generated when File plugin was included in the wizard.

Is there any bytes limitations on writing into the file?


« Last Edit: 26 May , 2008, 22:44:57 by kiranrprabhu » Logged
KL Admin
Moderator
Sr. Member
*****
Posts: 313


« Reply #3 on: 26 May , 2008, 23:42:59 »

This sounds exactly the POST method problem which is fixed by the patch.
If file plug-in is not working anymore you might have removed some files,
you don't need to, just overwrite corresponding files from the zip.
I think you can uninstall current KuneriLite, reinstall, install patch
and create new project.
I have strong feeling that it will work then Smiley

cheers,
Jukka
Logged
kiranrprabhu
Newbie
*
Posts: 15


« Reply #4 on: 27 May , 2008, 01:18:16 »

KuneriLiteWizard.0.9.6-Setup.exe

As per your adive, I uninstalled Kunerilite, installed again and downloaded the Kunerilite patches (KuneriLiteWizardPatch_0.9.6.2a_4.zip  and KuneriLitePatch_0.9.6.2b_8.zip) and replaced the files in Kunerilite\basic and Kunerilite\Basic\rsc folders.

As I mentioned earlier, installing patch and creating SIS installer generates the following error during SIS creation in wizard.

file I/O fault
ERROR! Failed at makesis "myProj.pkg"

The Kunerilite Test using the wizard successfully created the SIS installers.
Also if I do not use the File Plugin in wizard for my project SIS files are created successfully but once file plug in is included the above error shows in the coomand prompt.



KuneriLiteWizard.0.9.6.2-Setup.exe

Now I downloaded KuneriLiteWizard.0.9.6-Setup.exe, installed it, replaced the patches.
This worked!!! and I was able to create the Installer with the plugin. But my joy was short lived.

I installed the application in the device, the same old result of quitting the application with an addition that mobile hangs after the application is quit.
Logged
KL Admin
Moderator
Sr. Member
*****
Posts: 313


« Reply #5 on: 27 May , 2008, 01:56:21 »

My guess is that player crashes when header limit for GET exceeds,
when you concatenate strings in loadVariables
test="this is 1000 bytes long string..
loadVariables("http://127.0.0.1:1001/Basic/file?klCommand=write&klPath=test.txt&klData="+test, "");

but it doesn't crash if you use POST method:
loadVariables("http://127.0.0.1:1001/Basic/file?klCommand=write&klPath=test.txt&klData="+test, "", "POST");

or

klCommand="write";
klPath="test2.txt";
klData=test;
loadVariables("http://127.0.0.1:1001/Basic/file", "", "POST");

when you use 2nd method, loadVariables should be called in separate movieclip:
http://wiki.kunerilite.net/index.php?title=KuneriLite_Patch_0.9.6.2b

I hope this helps,
Jukka
Logged
kiranrprabhu
Newbie
*
Posts: 15


« Reply #6 on: 27 May , 2008, 02:12:35 »

I have used the "POST" as follows

loadVariables("http://127.0.0.1:1001/Basic/file?klCommand=write&klPath=myContacts.xml&klData="+_root.xmlMain, _root.main, "POST");

Where "xmlMain" is the xml object on the root timeline
         "main" is an empty movie clip in the root timeline that receives the kl commands



Logged
KL Admin
Moderator
Sr. Member
*****
Posts: 313


« Reply #7 on: 27 May , 2008, 02:34:41 »

Maybe there is also limitation in URL size as well, maybe you can try using 2nd method, without embedding variables in the URL?
Logged
kiranrprabhu
Newbie
*
Posts: 15


« Reply #8 on: 27 May , 2008, 02:53:46 »

Tried the second method....but no change in result.

Should I write node by node instead of writing entire xml object? I think this is the only way left before me.
Logged
KL Admin
Moderator
Sr. Member
*****
Posts: 313


« Reply #9 on: 27 May , 2008, 07:30:34 »

Hard to say without seeing closer.. maybe you should try to bound the problematic
line, to see where the crashing happens.
klrequest.txt and klresponse.txt might tell you something, but they are removed when applicatin closes, then might not.
Logged
kiranrprabhu
Newbie
*
Posts: 15


« Reply #10 on: 27 May , 2008, 23:22:59 »

Well I tried the second method again today with the following commands

_root.main.klEnd=-99;
_root.main.klError=-99;
klCommand="write";
klPath="\\data\\myDBAPP\\xml\\Contacts.xml";
klData=_root.xmlMain;
loadVariables("http://127.0.0.1:1001/Basic/file", _root.main, "POST");
gotoAndPlay(10);   //this location I will be iterating to check the value of klEnd

I tried this method in the simulator but, I traced the execution which is as below

klEnd=-99
klEnd=-99
Connected to http://127.0.0.1:1001/Basic/file.
Loaded data from http://127.0.0.1:1001/Basic/file.
Finished request for http://127.0.0.1:1001/Basic/file.
klEnd=1
klError=-28


As you can see that there is no hint of the klPath and klData in the above call and moreover klReqest.txt was empty. klError value is -28 (Given URL is malformed).

I saw some similiar problem in the topic "Max size for WRITE" in this forum between you and netsoul.

was that solved? If so how?
I coould not understand whether that is solved or no.

« Last Edit: 27 May , 2008, 23:34:27 by kiranrprabhu » Logged
KL Admin
Moderator
Sr. Member
*****
Posts: 313


« Reply #11 on: 28 May , 2008, 01:55:07 »

POST support is now added to Emulator as well (patch is available)
Please take also
http://wiki.kunerilite.net/index.php?title=KuneriLite_Patch_0.9.6.2b
There is no changes related to POST, but still worth to check.

I have tested similar xml-structure which has about 1K data, but I didn't manage to crash, so maybe it is related some else problem.
If you try patched Emulator, maybe we can have more ideas?

cheers,
Jukka
Logged
kiranrprabhu
Newbie
*
Posts: 15


« Reply #12 on: 28 May , 2008, 02:34:25 »

- POST method is recommended to be used only when there are few variables defined in the layer, preferably no else than KL related.
They can exist, but they must not coincide with KuneriLite related (i.e. not to have kl-prefix). This means calling should be done in separate KL-dedicated movie clip.


what does the above statement mean?

I tried adding the patch you recommended but as I said earlier the klRequest.txt is blank.

The traced output is shown below:

klEnd=-99
klEnd=-99
Connected to http://127.0.0.1:1001/Basic/file.
Loaded data from http://127.0.0.1:1001/Basic/file.
Finished request for http://127.0.0.1:1001/Basic/file.
klEnd=1
klError=-28
« Last Edit: 28 May , 2008, 02:54:47 by kiranrprabhu » Logged
KL Admin
Moderator
Sr. Member
*****
Posts: 313


« Reply #13 on: 29 May , 2008, 06:54:42 »

I tested your application, I know problem little better (but only little..)

Above statement means, that all variables defined in the same layer where loadVariables is called, are sent to KuneriLite, when "POST" method is used. If there are lot of variables defined, especially which user can input values into, "bloating" of loadVariables requests will happen in application.

It might happen in your application, after some time it just sends empty data and closes.
But I didn't manage to do same in another application: I tried creating many very long variables, sending them using POST method. Only your application crashed. So, I recommend to create another movieclip which contains only few variables.
It might be easy way out from the problem, I hope.

cheers,
Jukka
« Last Edit: 29 May , 2008, 06:56:24 by jusahama » Logged
kiranrprabhu
Newbie
*
Posts: 15


« Reply #14 on: 30 May , 2008, 04:25:47 »

I tried implementing LoadVariables in a separate movieClip as you had suggested but the result is not different.

When application is created using new wizard (with patches) and when my application quits, mobile either hangs or becomes slower.

Logged
Pages: [1] 2
  Print  
 
Jump to: