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-04-01 00:10 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-04-01 00: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 07:13 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!