matrixbegins Posted April 23, 2008 Share Posted April 23, 2008 Hello Everybody !! Thanks for devoting time. I am very new in php like an Infant. I have a Xml file Appsettings.xml like. <AppSettings> <images> <id>55</id> </images> </AppSettings> I can read this file By SimpleXML as follows: $content=simplexml_load_file("AppSettings.xml"); $imgid=$content->images->id; Now I want to read this value (images---> id i.e. 55) after some operations like increment by 1, I want to save this new value of the node in file too. that means the new value must reflect into xml file. I am Stucked with this problem. I tried dom but I got only help to create a new Xml File. Any way is this is possible? Please Help _____________________________________ With Warm Regards Ankur Quote Link to comment https://forums.phpfreaks.com/topic/102552-solved-editing-a-node-value-of-a-xml-file-in-php/ Share on other sites More sharing options...
rhodesa Posted April 23, 2008 Share Posted April 23, 2008 <?php $content=simplexml_load_file("AppSettings.xml"); $imgid = $content->images->id; $imgid++; $content->images->id = $imgid; $content->asXML("AllSettings.xml"); ?> Quote Link to comment https://forums.phpfreaks.com/topic/102552-solved-editing-a-node-value-of-a-xml-file-in-php/#findComment-525099 Share on other sites More sharing options...
matrixbegins Posted April 24, 2008 Author Share Posted April 24, 2008 Dear Mr. Rhodesa Thanks for ur great Help its working Just like I want Many thanks again, Ankur Quote Link to comment https://forums.phpfreaks.com/topic/102552-solved-editing-a-node-value-of-a-xml-file-in-php/#findComment-525645 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.