NYCPHP Meetup

NYPHP.org

[nycphp-talk] Modifying an XML tag name OR cloning an entire node including childnodes

Dynamic Ink nyphp at dynamicink.com
Sun May 27 21:56:38 EDT 2007


I need to modify an XML tag name and am having quite a few setbacks trying to do it with DOM.

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>

I could not figure out any way to change the readonly nodeName property, but I was able to make a new node, insert before the old node and then remove 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>

Anyone have any ideas how to get the entire node value including any subnodes that may appear within? Or better yet, how can I just modify an XML tag name and avoid this hassle altogether?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20070527/2a3202d4/attachment.html>


More information about the talk mailing list