1--TEST-- 2Dom\HTMLDocument serialization with an imported namespace node 04 3--EXTENSIONS-- 4dom 5--FILE-- 6<?php 7 8$xml = Dom\XMLDocument::createFromFile(__DIR__.'/sample.xml'); 9$xml->documentElement->appendChild($xml->createElementNS('some:ns2', 'child')); 10echo $xml->saveXml(), "\n"; 11 12echo "--- After import into HTML ---\n"; 13 14$html = Dom\HTMLDocument::createFromString('<p>foo</p>', LIBXML_NOERROR); 15 16$p = $html->documentElement->firstChild->nextSibling->firstChild; 17$p->appendChild($html->importNode($xml->documentElement, false)); 18 19echo $html->saveXml(), "\n"; 20echo $html->saveHtml(), "\n"; 21 22?> 23--EXPECT-- 24<?xml version="1.0" encoding="UTF-8"?> 25<container xmlns="some:ns" xmlns:bar="another:ns"> 26 <x> 27 <subcontainer> 28 <test xmlns="x:y"/> 29 <child2/> 30 </subcontainer> 31 <subcontainer2> 32 <foo xmlns="some:ns"/> 33 </subcontainer2> 34 </x> 35<child xmlns="some:ns2"/></container> 36--- After import into HTML --- 37<?xml version="1.0" encoding="UTF-8" standalone="yes"?> 38<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body><p>foo<container xmlns="some:ns" xmlns:bar="another:ns"/></p></body></html> 39<html><head></head><body><p>foo<container xmlns="some:ns" xmlns:bar="another:ns"></container></p></body></html> 40