Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Sep 2008
    Posts
    12
    Thanks
    2
    Thanked 0 Times in 0 Posts

    How to use JavaScript to read/write XML locally?

    I have an html page installed on the client.
    Also, I have an XML page installed on the client.
    The user loads the html page to view the XML data in a browser (Firefox).

    I am using JavaScript to read the XML file.

    Now I would like the user to be able to add, edit or delete nodes from the XML file (creating a mini database that can be updated by the user).

    Is this possible?

  • #2
    New Coder
    Join Date
    Jul 2008
    Location
    Peterborough - UK
    Posts
    63
    Thanks
    4
    Thanked 9 Times in 9 Posts
    My gut instinct is that this is only really possible with php, though I might well be wrong.

    I've done somthing similar in the past and I wrote a simple php script that read the XML file and echoed out a javascript array of the data.

    The client then uses/manipulates this data using Javascript.

    Upon 'saving' the alterations made, the page posted the javascript array to another php script which wrote the changes to the XML file.

    ...A similar process might be your best bet (though if this is possible using JS, I'd love to know how!)

  • #3
    New Coder
    Join Date
    Sep 2008
    Posts
    12
    Thanks
    2
    Thanked 0 Times in 0 Posts
    I hope it can be done in JS. The reason I am not using PHP is this is really not a web app. I am simply using the browser as the interface for the JS-powered database editor. So everything is run locally (no server involved = no PHP).


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •