Update XML Element in PHP
Updating XML node with PHP
// load the document
// the root node is <info/> so we load it into $info
$info = simplexml_load_file('test.xml');
// update
$info->user->name->nameCoordinate->xName = $xPostName;
$info->user->name->nameCoordinate->yName = $yPostName;
// save the updated document
$info->asXML('test.xml');
Example
$xmlDoc = new \DOMDocument;
$xmlDoc->load('Books.xml');
$response = $xmlDoc->getElementsByTagName('Text');
foreach ($response as $node){
$node->nodeValue = 'test';
}
$xmlDoc->saveXML();