1--TEST-- 2Test writing Element::$outerHTML on XML documents 3--EXTENSIONS-- 4dom 5--FILE-- 6<?php 7 8$dom = Dom\XMLDocument::createFromString("<root xmlns='urn:a'><x/></root>"); 9$dom->documentElement->firstChild->outerHTML = '<x xmlns="urn:a"><p>foo</p><p xmlns="urn:x">bar</p></x>'; 10echo $dom->saveXML(), "\n"; 11 12$dom->documentElement->firstChild->outerHTML = $dom->documentElement->firstChild->outerHTML; 13$element = $dom->documentElement->firstChild->firstChild; 14echo $dom->saveXML(), "\n"; 15 16$dom->documentElement->firstChild->outerHTML = 'tést'; 17echo $dom->saveXML(), "\n"; 18 19var_dump($element->tagName); 20 21$fragment = $dom->createDocumentFragment(); 22$fragment->appendChild($dom->createElement('p')); 23$fragment->firstChild->outerHTML = '<strong>bar</strong>'; 24echo $dom->saveXML($fragment), "\n"; 25 26?> 27--EXPECT-- 28<?xml version="1.0" encoding="UTF-8"?> 29<root xmlns="urn:a"><x xmlns="urn:a"><p>foo</p><p xmlns="urn:x">bar</p></x></root> 30<?xml version="1.0" encoding="UTF-8"?> 31<root xmlns="urn:a"><x xmlns="urn:a"><p>foo</p><p xmlns="urn:x">bar</p></x></root> 32<?xml version="1.0" encoding="UTF-8"?> 33<root xmlns="urn:a">tést</root> 34string(1) "p" 35<strong xmlns="http://www.w3.org/1999/xhtml">bar</strong> 36