vovanmozg / phpquery

Automatically exported from code.google.com/p/phpquery
0 stars 0 forks source link

Appending an element from a document to another document #18

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
<?php
$myFirstPQ = phpQuery:newDocument($myFirstHTMLCode);
$mySecondPQ = phpQuery:newDocument($mySecondHTMLCode);

$myFirstPQ_element = $myFirstPQ->find('#myElement');
$mySecondPQ_elements = $mySecondPQ->find('body:first > *');
foreach ($mySecondPQ_elements as $element)
   $myFirstPQ_element->append($element);
?>

What is the expected output? What do you see instead?
Appended an element from a document into another document.
<error>Fatal error: Uncaught exception 'DOMException' with message 'Wrong
Document Error'</error>

What version of the product are you using? On what operating system?
0.9.1 on a standart Apache server with PHP 5.2.6

Original issue reported on code.google.com by nicolas....@gmail.com on 28 Jul 2008 at 9:02

GoogleCodeExporter commented 8 years ago
It may occurs cause we need to associate the node with the target document 
first.
See http://www.mail-archive.com/xerces-j-user@xml.apache.org/msg03677.html

Original comment by nicolas....@gmail.com on 28 Jul 2008 at 9:09

GoogleCodeExporter commented 8 years ago
Modified version of code above avaible in /test-cases/test_multidoc.php.
Test passes successfully.

Original comment by tobiasz....@gmail.com on 29 Jul 2008 at 12:05

GoogleCodeExporter commented 8 years ago
It work well!
Thanks Tobiaz :D!

Original comment by nicolas....@gmail.com on 29 Jul 2008 at 7:43