DOM appendChild question
| From: | Dan Phiffer | Date: | Wed, 25 Feb 2004 19:16:58 +0000 |
| Subject: | DOM appendChild question | ||
| Groups: | php.xml.dev | ||
| Request: | Send a blank email to php-xml-dev+get-325@lists.php.net to get a copy of this message | ||
Sorry if this is the wrong forum for this, but should this work?
$doc = new DomDocument();
$doc->loadXML('<html><body></body></html>');
$hello = new DomDocument();
$hello->loadXML('<p>Hello world!</p>');
$xp = new DomXPath($doc);
$body = $xp->query('/html/body')->item(0);
$body->appendChild($hello->firstChild); // <-- Exception thrown here
echo $doc->saveHTML();
Here's the error message I'm getting:
Fatal error: Uncaught exception 'domexception' with message 'Wrong Document Error' in ... Stack trace: #0 {main} thrown in ... on line 18
I'm running PHP 5 beta 4 on Apache 1.3.29.
Thanks!
-Dan