|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-03-02 15:56 UTC] rrichards@php.net
[2005-03-02 17:27 UTC] clynx at succont dot de
[2005-03-02 22:27 UTC] clynx at succont dot de
[2005-03-02 23:18 UTC] rrichards@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 30 18:00:01 2025 UTC |
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)