I\'ve an XML file test.xml
FirstName
You have to write the changes back to the file, use the asXML method of the SimpleXMLElement.