in reply to Invalid XML characters

How about converting them to characters, as aforementioned? Have a look at HTML::Entities and XML::Entities.