tags:

views:

56

answers:

1

I am developing an application which requires the reading and writing of XML files. Reading I've got covered, but is writing possible at all? The layout of my webapp is like this:
../includes/ (irrelevant)
../content.xml (xml to be written to)
../index.html (irrelevant)
../admin.html (file to write with)
Any help appreciated, thanks.

+3  A: 

You will need to write some type of form handler or web service on the server side. Once this is done you can use AJAX to call the form handler or service and submit data that way.

Example- form.html -> submit -> formhandler.php -> content.xml

HurnsMobile
Thanks for the response buddy. Is it possible to do this without PHP or any other server-side language? Just HTML and JS? I've seen things like TiddlyWiki which allow editing of pages remotely.
Jason
No, this will require some amount of work on the server-side. TiddlyWiki for example is written in java (iirc)
HurnsMobile
So would it be possible then to have just a single PHP file with the sole task of writing XML files, while everything else could be HTML (i.e parsing and reading XML)?
Jason
Yes. Simply write a php file that takes data with `$_POST` and writes it to your backend XML. Then use jQuery `$.post` to submit whatever data you would like to it.
HurnsMobile
HurnsMobile
Righty. So there is absolutely no way, difficult or not and without using server-side scripts, to write to a remote file? If so, I'll have to resort to the single PHP file solution. Many thanks HurnsMobile.
Jason