DOM appendChild question

[email protected] (Dan Phiffer) Wed, 25 Feb 2004 11:16:58 -0800
Newsgroups php.xml.dev
Message-ID <[email protected]>
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