DOM appendChild question
| From: | Dan Phiffer | Date: | Wed, 25 Feb 2004 19:28:07 +0000 |
| Subject: | DOM appendChild question | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-178880@lists.php.net to get a copy of this message | ||
I'm getting an error from the following code, but the error message hasn't given me many leads:
$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