Get xmlelement text to String keeping escapes?

In XmlElement, Is there a way to get the content of getAllSubText() to a String but keeping the escapes? I need to extract parts of the XML tree and generate a html file from them, so I want to keep the escapes or have a way to recreate the escapes. I am aware that toString keeps escapes but it requires some parsing to remove unwanted tags.

Thanks