Storing data into an xml file
General and Desktop
3
Posts
3
Posters
2.1k
Views
1
Watching
-
Hi,
I have created a program that the user selects patients and their data and stores them into an xml file. My problem is that if the user selects twice the same patient, the program stores his/her data twice to the xml file.
Is their a function that checks the file before the insertion?
I should read the xml file first and then insert?
Or is their an easier way to do that? -
Since we do not know how your data is selected I would be inclined to keep a QMap of the selections. You can then iterate this map to create you XML, and since it is a map there would be no duplicates or prior to insert you could search the map and if the key does exists ask the user if they want to remove the already selected patient.
--
William