Exemplo n.º 1
0
 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
Exemplo n.º 2
0
    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())
Exemplo n.º 3
0
 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())
Exemplo n.º 4
0
 def __init__(self):
     ExpatParser.__init__(self)
     self.firsttime = True
Exemplo n.º 5
0
 def __init__(self, *args, **kwargs):
     _ExpatParser.__init__(self, *args, **kwargs)
     self.setFeature(handler.feature_external_ges, False)
     self.setFeature(handler.feature_external_pes, False)
Exemplo n.º 6
0
 def __init__(self, *args, **kwargs):
     _ExpatParser.__init__(self, *args, **kwargs)
     self.setFeature(handler.feature_external_ges, False)
     self.setFeature(handler.feature_external_pes, False)
Exemplo n.º 7
0
 def __init__(self):
     """Initialize the class."""
     ExpatParser.__init__(self)
     self.firsttime = True
Exemplo n.º 8
0
 def __init__(self):
     ExpatParser.__init__(self)
     self.firsttime = True
Exemplo n.º 9
0
 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
Exemplo n.º 10
0
 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
Exemplo n.º 11
0
 def __init__(self):
     """Initialize the class."""
     ExpatParser.__init__(self)
     self.firsttime = True
Exemplo n.º 12
0
"""
Exemplo n.º 13
0
 def __init__(self, *args, **kwargs):
     ExpatParser.__init__(self, *args, **kwargs)
     self.__entities = {}
Exemplo n.º 14
0
 def __init__(self, *args, **kwargs):
     ExpatParser.__init__(self, *args, **kwargs)
     self.__entities = {}