xpath('//table') as $item) { $attrs = $item->attributes(); $phpName = removePrefix ($attrs['name']); $item->addAttribute('phpName', $phpName); } if(isset($fileSave) && $fileSave != '') { $xmlFile = $fileSave; } else { $xmlFile = $filePath; } $xml->asXML($xmlFile); } else { exit('Failed to open file : '. $filePath); } ?>