How to clone an entire XML node including childnodes?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Basically I am trying to turn something like this:

 

<div>Hello <i>Joe</i>, nice to meet you</div>

 

into this:

 

<p>Hello <i>Joe</i>, nice to meet you</p>

 

by making a new node, inserting before the old node and then removing
the old node.

 

The problem is that I am populating the value of the new node with the
$oldNode->nodeValue property which apparently only includes text, not
child nodes, so I end up with:

 

<p>Hello Joe, nice to meet you</p>

 

How do you get the entire node value including any subnodes that may
appear within?

 

 

This is basically a variation on my previous post about how to
DomDocument->renameNode().


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux