I don't doubt something like this has been posted before but I don't know where to look.
I have to check the content of one element in one DCR (newcontent) and update the corresponding field of another DCR (oldcontent) if the corresponding element differs. I am doing this with TeamSite:

CRnode and it seems to work unless the element contains HTML, then I have to manually escape the XML-special LT/GTs. Is there any way to avoid this manual escaping? It seems like there should be some existing facility for escaping HTML for DCRs as dozens of organizations must have this problem and we can't all be coding escape logic, especially when the rules don't seem to be well-documented.
my ${oldnode} = new TeamSite:

CRnode( ${oldcontent} );
my ${newnode} = new TeamSite:

CRnode( ${newcontent} );
my ${oldval} = ${oldnode}->value( 'content' );
my ${newval} = ${newnode}->value( 'content' );
if ( ${oldval} ne ${newval} )
{
# how can the next two lines be avoided?
${newval} =~ s#<#<#g;
${newval} =~ s#>#>#g;
${newnode}->set_inner_xml( 'content', localEscapeForDCR( -value => ${newval} ));
}
# write DCR...