def safe_minidom_parse_string(xml_string):
 try:
  return minidom.parseString(xml_string, parser=ProtectedExpatParser())
 except sax.SAXParseException as se:
  raise expat.ExpatError()

def safe_minidom_parse_string ( xml_string ) : try : return minidom . parseString ( xml_string , parser = ProtectedExpatParser ( ) ) except sax . SAXParseException as se : raise expat . ExpatError ( )
parse an xml string using minidom safely .