Connecting Tech Pros Worldwide Forums | Help | Site Map

overwriting in xml file

Newbie
 
Join Date: Oct 2008
Posts: 7
#1: Nov 20 '08
I am doing a PHP DOM application.On basis of query some huge datas are selected and they are stored in an xml file.After doing certain calculations on this data i need to remove the existing data and replaced it with new one or is it possible to write the calculated data to another xml file.If so how can i do that.I tried many methods.But not getting worked.And this process of calculations and xml updations occur freqeuntly until some conditions in database are met.

What should i do to import calculated data to new xml file or replace it in same file.

Thanks for any help in advance.

Regards
scn87

Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,658
#2: Nov 20 '08

re: overwriting in xml file


if you have an xml file imported in DOMDocument you can save it to file by the save() method.

importing data to xml is similar to extracting data from xml, but without any information about that I can tell nothing.

regards
Newbie
 
Join Date: Oct 2008
Posts: 7
#3: Nov 20 '08

re: overwriting in xml file


I have saved it using save() method for first xml file(test.xml).

The first set of data are stored in test.xml file ,i need to do some calculations upon data of test.xml using php . Now the calculated result must be stored either in same xml file(by overwriting existing data) or save to a new xml file.

How to get data from the test.xml file to store to test1.xml .

Thanks
Regards
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,658
#4: Nov 20 '08

re: overwriting in xml file


without any information this is hard to tell, my usual guess would be, use DOM methods to find the according node and replace the value. basicly, do the extraction steps backwards (more or less).

whether or not you overwrite or save anew your updated xml is up to you.

regards
Reply