|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2010-01-29 18:35 UTC] rrichards@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 16:00:02 2025 UTC |
Description: ------------ libxml 2.6.31 When importing previously removed element into the new document the namespaceURI is not preserved. It is preserved only if the @xmlns declaration attribute is present on the element itself. Does not work if it was declared on former ancestor. Reproduce code: --------------- $rcpt=new DOMDocument; $rcpt->loadXML("<rcpt></rcpt>"); // XMLNS on parent $dnr1=new DOMDocument; $dnr1->loadXML("<dnr xmlns:sys='http://www.1stomni.com/spire'><sys:donate/></dnr>"); // XMLNS on element $dnr2=new DOMDocument; $dnr2->loadXML("<dnr><sys:donate xmlns:sys='http://www.1stomni.com/spire'/></dnr>"); getGift($rcpt, $dnr1->documentElement->removeChild($dnr1->documentElement->firstChild)); getGift($rcpt, $dnr2->documentElement->removeChild($dnr2->documentElement->firstChild)); function getGift($dom, $gift) { echo "before: \"$gift->namespaceURI\"; after: \"".$dom->documentElement->appendChild($dom->importNode($gift))->namespaceURI."\"\n"; } Expected result: ---------------- before: "http://www.1stomni.com/spire"; after: "http://www.1stomni.com/spire" before: "http://www.1stomni.com/spire"; after: "http://www.1stomni.com/spire" Actual result: -------------- before: "http://www.1stomni.com/spire"; after: "" before: "http://www.1stomni.com/spire"; after: "http://www.1stomni.com/spire"