Re: [xmljs-users] can it be done?
Brought to you by:
djoham,
witchhunter
From: Sean S. <si...@gm...> - 2005-07-30 21:46:12
|
I don't think it's possible to do what you want without some kind of change to the server. You want to save data to the server, so you have to change the server to be able to handle saving said data. I recommend using SQLite, and just a simple one table database. The .db file can be placed basically anywhere on the server's filesystem (as long as the web server process has write access to it and its directory). Then use PHP (or whichever language you prefer) to receive commands from the web page and communicate with the database. You could use XML for SCRIPT to read the data (I wouldn't), but you'd have to write your own Javascript functions to save it back to the database (at least that was true the last time I used XML for SCRIPT). I wrote a commercial application that had to read, parse, alter, and save XML data just a short while ago. Naturally, I can't reveal that code, but I've also written another non-commercial application that demonstrates what you have to do with SQLite, PHP, and Javascript to read and save data (however, it uses JSON instead of XML). Here's a link to a page demonstrating this stuff: http://seancode.blogspot.com/2005/07/graffiti.html The difference between JSON and XML in this case is that with JSON, the parsing and stringifying is done for you, so your code is a lot smaller. With XML, I had to write my own XML parsing functions using the DOM. This was the final reason I had to drop XML for SCRIPT for my application: I needed it to work cross-browser, and its XML parsing doesn't work on Safari or Konqueror. But using the DOM's getElementsByName functions work on all KJS, Gecko, and IE browsers. Also, in your PHP, when you're returning the XML to the browser, be sure to set the content type to text/xml (I think that's right) and use req.responseXML instead of req.responseText. The former gets you a DOM object that you can parse. The latter just gives you a string that you can't use any DOM functions on. I hope this helps a little. SEAN On 7/30/05, Ciprian Constantinescu <c.c...@gm...> wrote: > I need a catalog that is generated from a database in xml format. This > catalog is to be taken as xml from resellers and displayed on their page > with the posibility to navigate. The reseler takes only part of the catal= og, > that's why i need to keep the xml (genereted dinamic) on my server. Is th= ere > any method to cache the xml on the reseller server? > The problem is that i need a method which does not require the change of > configuration on the server of the reseller. Taking into account that i h= ave > about 300 resellers, each of them with about 2000-3000 visits/day, there > would be a very high amount of traffic on my server. Do you advise me to = use > XML for SCRIPT or to search another way of doing this? >=20 > --=20 > Ciprian Constantinescu > mobile: +40745192289 > e-mail: c_c...@ya... > e-mail: c.c...@gm...=20 > yahoo messenger: c_c...@ya... > msn messenger: c_c...@ya... |