Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.3.4

Bug #1110 addXmlString throws warning when calling append_child()
Submitted: 2004-03-31 18:10 UTC Modified: 2004-04-01 01:13 UTC
From: pear dot php dot net at brianmaddy dot com Assigned: chregu
Status: Closed Package: XML_sql2xml
PHP Version: 4.3.2 OS: Unix
Roadmaps: (Not assigned)    
Subscription  


 [2004-03-31 18:10 UTC] pear dot php dot net at brianmaddy dot com
Description: ------------ As of PHP 4.3.2, the append_child function works as specified in the DOM Level 2 specification (http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-184E7107). This causes the following error in XML_sql2xml::addXmlString and XML_sql2xml::add functions (probably some other add* functions also): Warning: append_child(): Can't append node, which is in a different document than the parent node... I believe the origional author meant to work around this by replacing a comment created a few lines earlier, but foorgot to finish the implementation. Anyway, here's the patch that got it to work foor me: --- sql2xml.php.orig Wed Mar 31 18:35:40 2004 +++ sql2xml.php Wed Mar 31 18:37:56 2004 @@ -816,7 +816,7 @@ // if no xpath is given, just take the whole file if ( (is_null($xpath))) { - $newchild->append_child($tmpxml->root()); + $newchild->replace_node($tmpxml->root()); } else { @@ -824,7 +824,7 @@ $xnode = xpath_eval($xctx,$xpath); foreach ($xnode->nodeset as $node) { - $newchild->append_child($node); + $newchild->replace_node($node); } } If one of the developers could add this to the next version, it would be appreciated! Thanks! Brian Reproduce code: --------------- $sqlXml->addXmlString('<date-today>asdf</date-today>'); echo $sqlXml->getXml(); Expected result: ---------------- <?xml version="1.0" ?> <root> <date-today>asdf</date-today> </root> Actual result: -------------- Warning: append_child(): Can't append node, which is in a different document than the parent node...

Comments

 [2004-04-01 01:13 UTC] chregu
This bug has been fixed in CVS. In case this was a documentation problem, the fix will show up at the end of next Sunday (CET) on pear.php.net. In case this was a pear.php.net website problem, the change will show up on the website in short time. Thank you for the report, and for helping us make PEAR better.