def __init__(self, namespaceHandling=0, bufsize=2 ** 16 - 20, forbid_dtd=False, forbid_entities=True, forbid_external=True): _ExpatParser.__init__(self, namespaceHandling, bufsize) self.forbid_dtd = forbid_dtd self.forbid_entities = forbid_entities self.forbid_external = forbid_external
def __init__(self, *args, **kwargs): """docstring for __init__""" ExpatParser.__init__(self, *args, **kwargs) class _NiftyEntityResolver(EntityResolver): """ _NiftyEntityResolver makes the entity errors disappear. It works by the html spec which says that external entities that can not resolved, do not have to be reported as an error by a non validating parser. """ def resolveEntity(self, publicId, systemId): "This will be called with None, None if it is an unknown entity" if systemId or publicId: return EntityResolver.resolveEntity( self, publicId, systemId) # return an empty stringio in which the parser can never find # the entities. This will make it skip the entity, which triggers # skippedEntity in the contenthandler. return StringIO.StringIO( " ") # if you delete that single space you will be sorry. self.setEntityResolver(_NiftyEntityResolver())
def __init__(self, *args, **kwargs): """docstring for __init__""" ExpatParser.__init__(self, *args, **kwargs) class _NiftyEntityResolver(EntityResolver): """ _NiftyEntityResolver makes the entity errors disappear. It works by the html spec which says that external entities that can not resolved, do not have to be reported as an error by a non validating parser. """ def resolveEntity(self, publicId, systemId): "This will be called with None, None if it is an unknown entity" if systemId or publicId: return EntityResolver.resolveEntity(self,publicId,systemId) # return an empty stringio in which the parser can never find # the entities. This will make it skip the entity, which triggers # skippedEntity in the contenthandler. return StringIO.StringIO(" ") # if you delete that single space you will be sorry. self.setEntityResolver(_NiftyEntityResolver())
def __init__(self): ExpatParser.__init__(self) self.firsttime = True
def __init__(self, *args, **kwargs): _ExpatParser.__init__(self, *args, **kwargs) self.setFeature(handler.feature_external_ges, False) self.setFeature(handler.feature_external_pes, False)
def __init__(self): """Initialize the class.""" ExpatParser.__init__(self) self.firsttime = True
def __init__(self, forbid_dtd=True, forbid_entities=True, *args, **kwargs): # Python 2.x old style class ExpatParser.__init__(self, *args, **kwargs) self.forbid_dtd = forbid_dtd self.forbid_entities = forbid_entities
"""
def __init__(self, *args, **kwargs): ExpatParser.__init__(self, *args, **kwargs) self.__entities = {}