in reply to An ampersand is not well-formed XML data?

Yup, just change it to &. XML supports - I think - five named entities: ", ', <, > and &. Note that you should also do this for all non-standard characters (i.e. above 127 in the ASCII char set).
s/([^\x1f-\x80])/"&#".ord($1).";"/ge;
Our Fearless Leader (tm) had the same problem with the xml nodes, and this is how he fixed, IIRC.

ar0n ]