dennismonsewicz Posted March 19, 2010 Share Posted March 19, 2010 Is there anyway to overwrite a value in an XML document? <?xml version="1.0"?> <files> <create> <name>coxdeductible.create.csv</name> </create> <insert> <name>coxdeductible.insert.csv</name> </insert> <check> <installed>no</installed> </check> </files> I want to rewrite the check value to be yes in my php program Link to comment https://forums.phpfreaks.com/topic/195848-xml-question/ Share on other sites More sharing options...
oni-kun Posted March 19, 2010 Share Posted March 19, 2010 You'd use the SimpleXML library that PHP should be installed with: <?php $xml = new SimpleXMLElement($xmlstring); $xml->files->create[2]->check->installed = yes; Don't quote me on the code, but you can easily manipulate XML with the extension: http://www.php.net/manual/en/simplexml.examples-basic.php Link to comment https://forums.phpfreaks.com/topic/195848-xml-question/#findComment-1028750 Share on other sites More sharing options...
dennismonsewicz Posted March 19, 2010 Author Share Posted March 19, 2010 You'd use the SimpleXML library that PHP should be installed with: <?php $xml = new SimpleXMLElement($xmlstring); $xml->files->create[2]->check->installed = yes; Hmmm I am using simplexml_load_string... how could I incorporate your example with that functionality? Don't quote me on the code, but you can easily manipulate XML with the extension: http://www.php.net/manual/en/simplexml.examples-basic.php Link to comment https://forums.phpfreaks.com/topic/195848-xml-question/#findComment-1028764 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.