Need to read from and write to an XML file from web forms
Posted on 2004-04-22
I have a new application I am working on for my company. There are 5 seperate aspx files with various information being entered. The user selects which page they want to view from a menu. Each page has its own "Save" button. No DB is involved with this, and I am told that one will not be needed for this application. I am pretty new to asp.net, so I need some guidance.
When a user chooses the "Save" button on a page, the information should be written to an XML file. If they then go to another page and save it, that information should be saved to the same XML file without overwriting any of the info saved from the previous aspx page. How would I go about doing this?
The next issue involves how I would go about updating info that already exists in the XML file. Say a user goes to a page and changes some information and then saves it. There is already info saved in and element that will not need to be updated. Is there an easy way to go about doing this? Essentially, I would need to check to see if the element that stores this info already exists. If not, then it needs to be added to the file, and if it does then I need to update the info.
I think I have figured out how to read the XML file so that I can display the info in the proper places on the aspx page. AT this point, I am dumping the XML file into a dataset and then using that to display the data I need for a particular page. Once again, is there an easy way to see if something exists within a data set?