I am trying to import XML from one document to another. This generally works fine, as demonstrated:
PHP Code:
<?php
  
  header
("Content-Type: application/xml");
  
  
$xml1 "<beer><guiness>yum</guiness></beer>";
  
$xml2 "<franziskaner><div>delicious</div></franziskaner>";
  
  
$doc1 = new DOMDocument();
  
$doc1->loadXML($xml1);
  
  
$doc2 = new DOMDocument();
  
$doc2->loadXML($xml2);
  
  
$doc1->documentElement->appendChild($doc1->importNode($doc2->documentElement,TRUE));
  
  die(
$doc1->saveXML());
  
?>
The output is good:
Code:
<beer>
    <guiness>yum</guiness>
    <franziskaner>
        <div>delicious</div>
    </franziskaner>
</beer>
The problem begins when the imported XML has a node with an xmlns attribute:
PHP Code:
$xml2 "<franziskaner><div xmlns=\"http://www.w3.org/1999/xhtml\">delicious</div></franziskaner>"
What happens to the output in this case, is all HTML nodes are then prefixed with "default":
Code:
<beer>
    <guiness>yum</guiness>
    <franziskaner xmlns:default="http://www.w3.org/1999/xhtml">
        <default:div xmlns="http://www.w3.org/1999/xhtml">delicious</default:div>
    </franziskaner>
</beer>
How can I import the XML "as is" without the "default" prefix?

Thanks
Aaron

I believe this is specific to PHP, as I tested the same code in C# with no issues.