n@1241: appendChild($toDom->ownerDocument->importNode($fromDom, true));
n@1241: }
n@1241:
n@1241: $file_key = $_GET['key'];
n@1241: $nodeName = $_GET['node'];
n@1241: $id = $_GET['id'];
n@1241: $filename = "saves/save-".$file_key.".xml";
n@1241: $save_ok = 'OK'.$filename.'';
n@1241: $save_error = 'Could not update the file'.$filename.'';
n@1241: $node = file_get_contents('php://input');
n@1241: $inject_xml = simplexml_load_string($node);
n@1241: $xml_string = file_get_contents($filename, FILE_TEXT);
n@1241: $xml_object = simplexml_load_string($xml_string);
n@1241:
n@1241: if ($nodeName == "waetresult") {
n@1241: sxml_append($xml_object, $inject_xml);
n@1241: } else {
n@1241: if ($id == "undefined") {
n@1241: return;
n@1241: } else {
n@1241: $result = $xml_object->xpath("".$nodeName."[@id='".$id."']");
n@1241: sxml_append($result[0], $inject_xml);
n@1241: }
n@1241: }
n@1241: $xml_object->asXML($filename)
n@1241: ?>