Jump to content

Call to undefined method DOMElement::save()


veaudaux

Recommended Posts

Stripped down version of my code:

 

 $xmlSubmission = simplexml_load_file($submissionDirectory . "/submissions.xml");

$newSubmission = $xmlSubmission->addChild('submission');
$newSubmission->addChild('title', 'XML Add Test');
$newSubmission->addChild('author_id', 'me');

$dom_xmlSubmission = dom_import_simplexml($xmlSubmission);
$dom = new DOMDocument('1.0');
$dom_xmlSubmission = $dom->importNode($dom_xmlSubmission, true);
$dom_xmlSubmission = $dom->appendChild($dom_xmlSubmission);

$test = $dom_xmlSubmission->save($submissionServerPath . "submissions2.xml");

 

This outputs a file with nothing but "<?xml version="1.0"?>" and spits an error "Fatal error: Call to undefined method DOMElement::save()". Now what?

Link to comment
https://forums.phpfreaks.com/topic/49495-call-to-undefined-method-domelementsave/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.