PDA

View Full Version : XML Updating help! Simple as possible.


spawnthing
07-02-2008, 07:39 PM
Hi,

Hope someone could explain (please make it as simple as possible for a noob like me) how to update a static XML that serves as an openlaszlo database.

See, I am only new to Openlaszlo and XML. I need anyones help with regards to updating an XML database thru openlaszlo.

I've dig some samples thru searching an it looks like this.

<canvas height="200" width="700" bgcolor="#D4D0C8">
<dataset name="dset" src="phonebook.xml"/>
<simplelayout axis="y"/>
<view datapath="dset:/phonebook/contact">
<simplelayout axis="y"/>

<view name="list" onclick="parent.updateContact.setAttribute('visible', !parent.updateContact.visible);">
<simplelayout axis="x"/>
<text datapath="@firstName"/>
<text datapath="@lastName"/>
<text datapath="@phone"/>
<text datapath="@email"/>
</view>

<view name="updateContact" visible="false" x="20" height="120">
<text y="10">First Name:</text>

<edittext name="firstName" datapath="@firstName" x="80" y="10"/>
<text y="35">Last Name:</text>
<edittext name="lastname" datapath="@lastName" x="80" y="35"/>

<text y="60">Phone:</text>
<edittext name="phone" datapath="@phone" x="80" y="60"/>

<text y="85">Email:</text>
<edittext name="email" datapath="@email" x="80" y="85"/>

<button width="80" x="200" y="10">Update
<handler name="onclick">
parent.parent.datapath.updateData();
</handler>
</button>

<button width="80" x="200" y="40">Delete
<handler name="onclick">
parent.parent.datapath.deleteNode();
</handler>
</button>

</view>
</view>
</canvas>

The samples turns out to be fine, it is able to update and delete data, but I was surprised when I reload the page. The old datas are still there, so I checked my XML database and the datas are still intact.

kind regards,

spawnthing

rcyeager
07-02-2008, 08:07 PM
You do realize, that if you use a file as a database that one and only one person can run your app at a time unless you take care to do file locking?

Before going down this path, is that what you want to do?

Robert Yeager
http://www.qrowd.com
http://www.cooqy.com

spawnthing
07-02-2008, 09:21 PM
Yes sir,

I do have some knowledge about file locking.

But, can you please provide me with a sample code about my problem? If that is ok with you.

please shed some more light to my agony.

kind regards,

spawnthing

kampfkolosso
07-02-2008, 10:10 PM
Hi spawny!

Ok, seems always somehow misleading, but OL never touches your data on the server. Changes done by OL are just in the temporary dataset on your computer. If you reload the page, OL loads the data from the server again and you start all over again.

Your data is not and can't be changed permanently only by OL. You've to have some kind of script you call on the server (JSP,PHP,etc.) that does this for ya.

hope that shows the path.
best regs!

hokage
07-02-2008, 10:34 PM
i hope this link will help you http://guestblox.blogspot.com/

they have example for what you need in guestblog application

since the link for the source code is gone...i'll put the code bellow...yeah i still have it :) ...

spawnthing
07-02-2008, 10:35 PM
kampfkolosso,

Thank you so much for pulling me back on track. :)

I quess what I really wanted was the script to do that (write data on the database in the server).

Actually, I started coding scripts with my friends, but of no luck at all.

If you are kind enough to provide me with just a simple (JSP,PHP,etc.) script to do that it would be much of a help for me.

kind regards,

spawnthing

spawnthing
07-02-2008, 10:39 PM
i hope this link will help you http://guestblox.blogspot.com/

they have example for what you need in guestblog application

since the link for the source code is gone...i'll put the code bellow...yeah i still have it :) ...

Thank you so much for the overwhelming responses guys.

I must admit I'm really struggling learning Openlaszlo, well, I quess I'm learning more and more about it each day.

kind regards,

spawnthing

spawnthing
07-03-2008, 01:26 AM
i hope this link will help you http://guestblox.blogspot.com/

they have example for what you need in guestblog application

since the link for the source code is gone...i'll put the code bellow...yeah i still have it :) ...


Hokage-sama,

Are you Mr. Lyndon Wong? :)

Anyways, the guestbook that you gave me was I think not functioning.

Well, I updated some links to make it run thru openlaszlo and I did make it run but the problem is, It dosen't seem to be working. I typed in my name on the textbox and clicked 'View Guest List' or 'Join Guest List', nothing seems to happen, not even if i set the laszlo debugger ='true'.

Thank you in advance Hokage-sama.

kind regards,

spawnthing

kampfkolosso
07-03-2008, 09:26 AM
Hi spawny!

i'm working on quite handy tool called xtirer with which you can easily read & write data from and to a mysql DB. If you're interested i give you my latest beta and post some intructions on my blog.

I've some projects already running on xtirer. The documentation is my missing point at the moment >:((

spawnthing
07-03-2008, 05:11 PM
Kampfkolosso-sama!

Sure, It would be a great help for me. Thank you so much.

kind regards,

spawnthing

spawnthing
07-03-2008, 05:18 PM
I've googled about xtirer sir and I found this link.

http://doapspace.org/doap/sf/xtirer

Is this the one that you are referring to sir?

I downloaded the 0.2 beta release of it sir.

kind regards,

spawnthing

spawnthing
07-03-2008, 05:28 PM
All I need right now sir is the Instruction on how to use it.

I just want to ask, Did you develop this?

mico
07-03-2008, 08:57 PM
your local application has no access of write of files
you must visit that via a server

spawnthing
07-03-2008, 09:06 PM
your local application has no access of write of files
you must visit that via a server

Thank you for the help sir mico,

But can you please elaborate further sir, you see I'm still really new to this.

kind regards,

spawnthing

mico
07-03-2008, 09:34 PM
i mean js has no write access of locals files , not even for those on server

i think the most simple way for you is writing a ajax portal service which can simplely provide interface for CRUD of xml files by repositing the doc model in memory , while the interface for write must be synchronized

your datasource is ...xml
so why not change that to a /AjaxService?target=...&cmd=add/delete/...&data=${serialized...}

kampfkolosso
07-03-2008, 10:04 PM
Hey spawny!

Yeah - documentation is missing. Hm, i will work out one brief today and post the link here. So pls be patent for some hours.

But for installing:

#1 extract the whole thing and copy it to your webserver / web dev environment.
You have a config.dummy.inc.php file which you should open in a text editor
and change the values for database, dbframe, user and password to get the connection to mysql working.

#2 By default u will need a directory called prototypes, where u store your xml-prototypes in.

All requests will be handled by the xtirer.php file. So if you're willing to add that to your OL scripts, just go on.

Ok, rest will come soon - promise :o!

Cheers

p.s.: just for info, the original location is: http://sourceforge.net/projects/xtirer/

spawnthing
07-03-2008, 10:23 PM
Hey spawny!

Yeah - documentation is missing. Hm, i will work out one brief today and post the link here. So pls be patent for some hours.

But for installing:

#1 extract the whole thing and copy it to your webserver / web dev environment.
You have a config.dummy.inc.php file which you should open in a text editor
and change the values for database, dbframe, user and password to get the connection to mysql working.

#2 By default u will need a directory called prototypes, where u store your xml-prototypes in.

All requests will be handled by the xtirer.php file. So if you're willing to add that to your OL scripts, just go on.

Ok, rest will come soon - promise :o!

Cheers

p.s.: just for info, the original location is: http://sourceforge.net/projects/xtirer/

Well, thank you so much sir.

I'm really empress of your replys, thank you so much for your overwhelming support for me. :) Hope, this thread can also help other starters like me.

kind regards,

spawnthing

kampfkolosso
07-04-2008, 05:16 AM
Hey spawny!

Ok, started documenting on my blog; Install & Simple DB Reading are briefly finished: http://blog.3gradlinks.com/category/xtirer/
Every feedback very welcome!

Cheers!

spawnthing
07-04-2008, 10:37 PM
Ok Kampfy!

I'm saving it for local veiwing later, cuz sorta busy right now with something else. But I did a quick review about it and it seems to be so brief to understand. Thank you for the help (really amazing help) you gave me.

Hope to hear updates every now and then from you sensei. :)

And hope that you will continue supporting me with the probs that I will encounter in the future, and hope that I can help you also. :)

kind regards,

spawnthing

kampfkolosso
07-15-2008, 11:28 AM
Hi everybody!

Thanks to spawnthing i've finally finished my introduction to Xtirer and i hope someone can make any use of it.

So check out the summary with all 6 parts of the intro to Xtirer (http://blog.3gradlinks.com/2008/07/xtirer-02-introduction-summary/) at my blog.

Cheers & i hope you like it!