Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP5 + DOM

Status
Not open for further replies.

LinuXelite

Programmer
Jun 21, 2002
150
CA
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,
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top