Hi,

<?php
$x1 = <<<EOT
<a p1="v1">
        <a1 p1="vv1"/>
</a>
EOT;
$x2 = <<<EOT
<b p1="v1">
        <b1 p1="vv1"/>
</b>
EOT;

$X1 = new DOMDocument();
$X1->loadXML($x1);
$X2 = new DOMDocument();
$X2->loadXML($x2);

$X1->firstChild->appendChild($X2->firstChild->cloneNode(true));

echo htmlspecialchars($X1->saveXML());
?>


I got an error in the line $X1->firstChild->appendChild...
[01-Feb-2007 22:20:29] PHP Fatal error: Uncaught exception 'DOMException' with message 'Wrong Document Error' in E:\www\mysite\htdocs\combine.php:17

How can I combine these 2 XMLs to get:
<a p1="v1">
        <a1 p1="vv1"/>
        <b p1="v1">
                <b1 p1="vv1"/>
        </b>
</a>

-thanks! :-)

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to