Can't you call `render_xml_to_string()` instead of copy/pasting it then ?