You may consider the option of fixing it in the originating system, where the garbage are produced.
if not, xml or encoding utilities will not work.
I guess you have to write some java code to scan through the document to only encode the content, not the xml tags.
It will be painful. keep in mind to deal with attributes and namespaces.
<?xml version="1.0" encoding="utf-8"?>
20120221
Ms
Ms
This is an Example & Escape "CHAR"
You expect to escape the ’ " ’ inside HeaderText, but how the program can know the ‘<’ of HeaderText is not an escape char inside QuoteProperties, you can’t define which to escape and which not, so program don’t know what to do.