I’m working on a small hobby project for personal use, which requires a way to store some values. The three ways of doing this that I could come up with were using: a MySQL db, a XML file or HTML5’s LocalStorage (please post a comment if there are other convenient ways you can think of).
Now since I might want to access the same values from another browser, for instance a mobile device, LocalStorage is clearly not the way to do it. Now when it comes to XML, I know it is only meant as a mean of transporting data, while data storage should be done in MySQL. However, since this is a small project which only would require a XML file of no more than a couple kilobytes, it feels like using XML would be more convenient in this case than setting up a MySQL db. Am I right?
Assuming I want to use XML, how do I append some nodes using a) PHP and b) JQuery or otherwise? Which one do you think is the most convenient way to do it?
I found that there are few well-written examples out there of how to do this (especially with JQuery I wasn’t able to find an example of how to append an XML file in a straightforward way), so it would be awesome if you could attach some sample code for comparison, thank you!
First of all – jQuery is client side script library. It means that actions performed using jQuery (inc. XML file manipulation) are done on the client side and doesn’t affect the server side. One may say that jQuery can preform actions on the server side, by using AJAX, but in fact it is the server script (php/perl/asp(x)) is the one preforming the action.
So let’s say that you have a small amount of data that you need to query and update. This can be done by either using “flat” file system or using database.