ID: 32163 User updated by: clynx at succont dot de Reported By: clynx at succont dot de Status: Bogus Bug Type: DOM XML related Operating System: FreeBSD 4.11 PHP Version: 5CVS-2005-03-02 (dev) New Comment:
Sorry for answering here, but what is the sense of these Fragments then? Appending an Empty Fragments throws an Error that "Document Fragment is empty". When Inserting the Fragment removes the Childs, these Object is not really usable, or am I wring here? Just a second thing which comes in my mind. Why does $dom2->saveXML() shows the complete Structure like it should be? Thanks for your time Previous Comments: ------------------------------------------------------------------------ [2005-03-02 15:56:13] [EMAIL PROTECTED] Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php Appending fragment removes the nodes from the fragment. Otherwise it breaks xsl, xpath and unexpected tree navigation results. ------------------------------------------------------------------------ [2005-03-02 15:31:01] clynx at succont dot de Description: ------------ When creating a new DocumentFragment, and appending some Child Nodes, the Fragment is still Empty. The Content is inside the DomDocument, but cannot be accessed through the Fragment Node. Reproduce code: --------------- <?php $xmlData = <<<XMLDATA <?xml version="1.0" encoding="ISO-8859-1" ?> <root> <subElement>content</subElement> </root> XMLDATA; $dom = new DomDocument; $dom->loadXML( $xmlData ); $dom2 = new DomDocument; $fragment = $dom2->createDocumentFragment(); foreach( $dom->childNodes AS $node ) { $newNode = $dom2->importNode( $node, true ); $fragment->appendChild( $newNode ); } $dom2->appendChild( $fragment ); echo $dom2->saveXML( $fragment ); ?> Expected result: ---------------- <root> <subElement>content</subElement> </root> Actual result: -------------- no output (empty String is returned) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=32163&edit=1