Fix #610, skip over invalid texts when creating XML.