I have an almost indentical problem to this - however, I am using C#.
I'm not here to argue the validity of the XML.
What gets sent in is out of my control.
Input XML:
<PNODE>
<CNODE>This string contains > and < and & chars.</cnode>
</PNODE>
I need it to look like this:
<PNODE>
<CNODE>This string contains > and < and & chars.</CNODE>
</PNODE>
It looks like the guy found a solution for PHP- which doesn't help me.
However, I need to find a way escape the &, > and < characters inside the node, but leave the tag declarations alone.