def CreateClassFromXMLString(target_class, xml_string, string_encoding=None):
 encoding = (string_encoding or XML_STRING_ENCODING)
 if (encoding and isinstance(xml_string, unicode)):
  xml_string = xml_string.encode(encoding)
 tree = ElementTree.fromstring(xml_string)
 return _CreateClassFromElementTree(target_class, tree)

def CreateClassFromXMLString ( target_class , xml_string , string_encoding = None ) : encoding = ( string_encoding or XML_STRING_ENCODING ) if ( encoding and isinstance ( xml_string , unicode ) ) : xml_string = xml_string . encode ( encoding ) tree = ElementTree . fromstring ( xml_string ) return _CreateClassFromElementTree ( target_class , tree )
creates an instance of the target class from the string contents .