ID:               32163
 Updated by:       [EMAIL PROTECTED]
 Reported By:      clynx at succont dot de
-Status:           Open
+Status:           Bogus
 Bug Type:         DOM XML related
 Operating System: FreeBSD 4.11
 PHP Version:      5CVS-2005-03-02 (dev)
 New Comment:

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.


Previous Comments:
------------------------------------------------------------------------

[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

Reply via email to