I would like to append XML to DOMNode element, but I got the error : "Wrong Document Error".
Here is my code :
$dom = new \DOMDocument();
$dom->loadXML($xmlResources->asXml());
$orderNodeList = $dom->getElementsByTagName('order');
foreach ($orderNodeList as $orderNode) {
$idAddressDelivery = $orderNode->getElementsByTagName('id_address_delivery')->item(0)->nodeValue;
$xmlToAppend = $this->getSpecificResource('addresses', $idAddressDelivery); //It returns a SimpleXMLElement
$tmpNode = new \DOMDocument(); //I create a DOMDocument
$tmpNode->loadXML($xmlToAppend->asXML()); //I fill it with XML
$orderNode->appendChild($tmpNode); //I want to put the new XML inside the DOMNode, but it throws an error
}
I've searched on the web, but don't know how to make it, could you tell what's wrong please ?
Thank you for your help ^^