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

Just read inside the W3 Recommendation, because the Manual tells that
is Extension follows the Standard as most as possible.
Now I think that this behaviour is not correct after the Standard.
It exactly says 'When a DocumentFragment is inserted into a Document
... the children of the DocumentFragment and not the DocumentFragment
itself are inserted into the Node.'. Currently this is not the case in
PHP.

I've read your comment about XSL problems, and I think you are talking
about a bug which was submitted by me, too. 
IMHO it's no solution to switch the Feature of to Fix a Bug.

Maybe I'm completly wrong. If so, please forgive me. Please give me
some Information how this should be done in the right way. The Support
in this Extension is a little bit rare out there ;o)

Regards


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

[2005-03-02 17:27:09] clynx at succont dot de

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

------------------------------------------------------------------------

[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

Reply via email to