def clean_xml_string(s):
 return u''.join((c for c in s if is_valid_xml_char_ordinal(ord(c))))

def clean_xml_string ( s ) : return u'' . join ( ( c for c in s if is_valid_xml_char_ordinal ( ord ( c ) ) ) )
cleans string from invalid xml chars solution was found there:: URL .