當前位置: 首頁>>代碼示例>>Python>>正文


Python sgmllib.SGMLParser方法代碼示例

本文整理匯總了Python中sgmllib.SGMLParser方法的典型用法代碼示例。如果您正苦於以下問題:Python sgmllib.SGMLParser方法的具體用法?Python sgmllib.SGMLParser怎麽用?Python sgmllib.SGMLParser使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在sgmllib的用法示例。


在下文中一共展示了sgmllib.SGMLParser方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: parse_declaration

# 需要導入模塊: import sgmllib [as 別名]
# 或者: from sgmllib import SGMLParser [as 別名]
def parse_declaration(self, i):
        """Treat a bogus SGML declaration as raw data. Treat a CDATA
        declaration as a CData object."""
        j = None
        if self.rawdata[i:i+9] == '<![CDATA[':
             k = self.rawdata.find(']]>', i)
             if k == -1:
                 k = len(self.rawdata)
             data = self.rawdata[i+9:k]
             j = k+3
             self._toStringSubclass(data, CData)
        else:
            try:
                j = sgmllib.SGMLParser.parse_declaration(self, i)
            except sgmllib.SGMLParseError:
                toHandle = self.rawdata[i:]
                self.handle_data(toHandle)
                j = i + len(toHandle)
        return j 
開發者ID:MrH0wl,項目名稱:Cloudmare,代碼行數:21,代碼來源:beautifulsoup-bk.py

示例2: __init__

# 需要導入模塊: import sgmllib [as 別名]
# 或者: from sgmllib import SGMLParser [as 別名]
def __init__(self):
		sgmllib.SGMLParser.__init__(self) 
開發者ID:rafasashi,項目名稱:razzy-spinner,代碼行數:4,代碼來源:tags.py

示例3: __init__

# 需要導入模塊: import sgmllib [as 別名]
# 或者: from sgmllib import SGMLParser [as 別名]
def __init__(self, formatter, verbose=0):
        """Creates an instance of the HTMLParser class.

        The formatter parameter is the formatter instance associated with
        the parser.

        """
        sgmllib.SGMLParser.__init__(self, verbose)
        self.formatter = formatter 
開發者ID:glmcdona,項目名稱:meddle,代碼行數:11,代碼來源:htmllib.py

示例4: reset

# 需要導入模塊: import sgmllib [as 別名]
# 或者: from sgmllib import SGMLParser [as 別名]
def reset(self):
        sgmllib.SGMLParser.reset(self)
        self.savedata = None
        self.isindex = 0
        self.title = None
        self.base = None
        self.anchor = None
        self.anchorlist = []
        self.nofill = 0
        self.list_stack = []

    # ------ Methods used internally; some may be overridden

    # --- Formatter interface, taking care of 'savedata' mode;
    # shouldn't need to be overridden 
開發者ID:glmcdona,項目名稱:meddle,代碼行數:17,代碼來源:htmllib.py

示例5: __init__

# 需要導入模塊: import sgmllib [as 別名]
# 或者: from sgmllib import SGMLParser [as 別名]
def __init__(self):
        sgmllib.SGMLParser.__init__(self) 
開發者ID:italia,項目名稱:daf-recipes,代碼行數:4,代碼來源:html_check.py

示例6: __init__

# 需要導入模塊: import sgmllib [as 別名]
# 或者: from sgmllib import SGMLParser [as 別名]
def __init__(self, encoding, _type):
        self.encoding = encoding
        self._type = _type
        sgmllib.SGMLParser.__init__(self) 
開發者ID:liantian-cn,項目名稱:RSSNewsGAE,代碼行數:6,代碼來源:feedparser.py

示例7: reset

# 需要導入模塊: import sgmllib [as 別名]
# 或者: from sgmllib import SGMLParser [as 別名]
def reset(self):
        self.pieces = []
        sgmllib.SGMLParser.reset(self) 
開發者ID:liantian-cn,項目名稱:RSSNewsGAE,代碼行數:5,代碼來源:feedparser.py

示例8: feed

# 需要導入模塊: import sgmllib [as 別名]
# 或者: from sgmllib import SGMLParser [as 別名]
def feed(self, data):
        data = re.compile(r'<!((?!DOCTYPE|--|\[))', re.IGNORECASE).sub(r'&lt;!\1', data)
        data = re.sub(r'<([^<>\s]+?)\s*/>', self._shorttag_replace, data)
        data = data.replace('&#39;', "'")
        data = data.replace('&#34;', '"')
        try:
            bytes
            if bytes is str:
                raise NameError
            self.encoding = self.encoding + u'_INVALID_PYTHON_3'
        except NameError:
            if self.encoding and isinstance(data, unicode):
                data = data.encode(self.encoding)
        sgmllib.SGMLParser.feed(self, data)
        sgmllib.SGMLParser.close(self) 
開發者ID:liantian-cn,項目名稱:RSSNewsGAE,代碼行數:17,代碼來源:feedparser.py

示例9: parse_declaration

# 需要導入模塊: import sgmllib [as 別名]
# 或者: from sgmllib import SGMLParser [as 別名]
def parse_declaration(self, i):
        try:
            return sgmllib.SGMLParser.parse_declaration(self, i)
        except sgmllib.SGMLParseError:
            # escape the doctype declaration and continue parsing
            self.handle_data('&lt;')
            return i+1 
開發者ID:liantian-cn,項目名稱:RSSNewsGAE,代碼行數:9,代碼來源:feedparser.py

示例10: __init__

# 需要導入模塊: import sgmllib [as 別名]
# 或者: from sgmllib import SGMLParser [as 別名]
def __init__(self, url, verbose=VERBOSE, checker=None):
        self.myverbose = verbose # now unused
        self.checker = checker
        self.base = None
        self.links = {}
        self.names = []
        self.url = url
        sgmllib.SGMLParser.__init__(self) 
開發者ID:aliyun,項目名稱:oss-ftp,代碼行數:10,代碼來源:webchecker.py

示例11: __init__

# 需要導入模塊: import sgmllib [as 別名]
# 或者: from sgmllib import SGMLParser [as 別名]
def __init__(self, entitydefs=None, encoding=DEFAULT_ENCODING):
        sgmllib.SGMLParser.__init__(self)
        _AbstractFormParser.__init__(self, entitydefs, encoding) 
開發者ID:krintoxi,項目名稱:NoobSec-Toolkit,代碼行數:5,代碼來源:clientform.py

示例12: feed

# 需要導入模塊: import sgmllib [as 別名]
# 或者: from sgmllib import SGMLParser [as 別名]
def feed(self, data):
        try:
            sgmllib.SGMLParser.feed(self, data)
        except SGMLLIB_PARSEERROR, exc:
            raise ParseError(exc) 
開發者ID:krintoxi,項目名稱:NoobSec-Toolkit,代碼行數:7,代碼來源:clientform.py

示例13: close

# 需要導入模塊: import sgmllib [as 別名]
# 或者: from sgmllib import SGMLParser [as 別名]
def close(self):
        sgmllib.SGMLParser.close(self)
        self.end_body()


# sigh, must support mechanize by allowing dynamic creation of classes based on
# its bundled copy of BeautifulSoup (which was necessary because of dependency
# problems) 
開發者ID:krintoxi,項目名稱:NoobSec-Toolkit,代碼行數:10,代碼來源:clientform.py


注:本文中的sgmllib.SGMLParser方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。