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