public function removeSkin($skin2remove){ // conversion from simplexml to DOM $convertedXML = dom_import_simplexml($this->xml); $convertedXML = $this->dom->importNode($convertedXML, true); $convertedXML = $this->dom->appendChild($convertedXML); // removing of the selected node $toremove = $convertedXML->getElementById($skin2remove); $oldnode = $convertedXML->removeChild($toremove); // reconversion from DOM to simplexml, and save $this->dom->normalize(); $this->xml = simplexml_import_dom($this->dom); $this->xml->asXml($this->file); }