LinuXelite
Programmer
Hi
How come "cloneNode" don't copy the namespace!
Example:
$myNode1 represente a dom node:
<w:tr>
<w:td>test</w:td>
</w:tr>
$myNode2 = $myNode1->cloneNode(true);
or
$myNode2 = clone $myNode1;
produces:
<tr>
<w:td>test</w:td>
</tr>
Notice that I just lost my prefix for the "tr" element.
How do you clone a node WITH its namespace?
I did it using a copy of the domDocument and using the importNode function. Howerver this is not always a good solution.
Thanks,
How come "cloneNode" don't copy the namespace!
Example:
$myNode1 represente a dom node:
<w:tr>
<w:td>test</w:td>
</w:tr>
$myNode2 = $myNode1->cloneNode(true);
or
$myNode2 = clone $myNode1;
produces:
<tr>
<w:td>test</w:td>
</tr>
Notice that I just lost my prefix for the "tr" element.
How do you clone a node WITH its namespace?
I did it using a copy of the domDocument and using the importNode function. Howerver this is not always a good solution.
Thanks,