Remove invalid XML characters when processing output

Hi,

First of all, thank you for your script.

I have found some situation in which the generated XML file is not valid, because in reason descriptions there can be invalid XML characters (in my specific case, I have found <, > and &, but maybe there can be more).