1--TEST-- 2DOMDocument::adoptNode() with attribute references 3--EXTENSIONS-- 4dom 5--FILE-- 6<?php 7 8$dom = new DOMDocument; 9$root = $dom->appendChild($dom->createElement('root')); 10$root->setAttributeNS("urn:a", "a:root1", "bar"); 11$root1 = $root->getAttributeNodeNS("urn:a", "root1"); 12echo $dom->saveXML(); 13 14$dom = new DOMDocument; 15$dom->appendChild($dom->adoptNode($root)); 16foreach ($dom->documentElement->attributes as $attr) { 17 var_dump($attr->namespaceURI, $attr->prefix, $attr->localName, $attr->nodeValue); 18} 19 20?> 21--EXPECT-- 22<?xml version="1.0"?> 23<root xmlns:a="urn:a" a:root1="bar"/> 24string(5) "urn:a" 25string(1) "a" 26string(5) "root1" 27string(3) "bar" 28