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