Fixes #6497 by Removing invalid XML characters from the object