|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2008-04-18 12:06 UTC] daniel dot gorski at develnet dot org
[2008-04-18 12:30 UTC] chregu@php.net
[2014-08-18 05:54 UTC] fuzzy76 at fuzzy76 dot net
[2014-10-27 20:10 UTC] ppkrauss at gmail dot com
[2014-10-27 21:06 UTC] don dot lacuran at gmail dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 06:00:01 2025 UTC |
Description: ------------ The DOMDocumentFragment::appendXML() function spits warnings if it comes to insertion of XML with namespace-prefixed elements. This of course would make sense if the namespaces were not definied, but they are - at least in the parent document. regards dtg Reproduce code: --------------- <?php error_reporting(E_ALL); $doc = new DOMDocument(); $doc->loadXML('<root xmlns:name="..."/>'); $frag = $doc->createDocumentFragment(); $frag->appendXML('<name:element>text</name:element>'); $doc->documentElement->appendChild($frag); echo htmlentities($doc->saveXML()); ?> Expected result: ---------------- <?xml version="1.0"?> <root xmlns:name="..."><element>text</element></root> Actual result: -------------- Warning: DOMDocumentFragment::appendXML() [domdocumentfragment.appendxml]: namespace error : Namespace prefix name on element is not defined in ... on line 9 Warning: DOMDocumentFragment::appendXML() [domdocumentfragment.appendxml]: <name:element>text</name:element> in ... on line 9 Warning: DOMDocumentFragment::appendXML() [domdocumentfragment.appendxml]: ^ in ... on line 9 <?xml version="1.0"?> <root xmlns:name="..."><element>text</element></root>