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 Quote Link to comment 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 Quote Link to comment 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 Quote Link to comment 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.