コード例 #1
0
    def _parse(self, str):
        """ Parses the text data from an XML element defined by tag.
        """

        str = replace_entities(str)
        str = strip_tags(str)
        str = collapse_spaces(str)
        return str
コード例 #2
0
ファイル: google.py プロジェクト: imclab/plotdevice-libs
    def _parse(self, str):

        """ Parses the text data from an XML element defined by tag.
        """

        str = replace_entities(str)
        str = strip_tags(str)
        str = collapse_spaces(str)
        return str
コード例 #3
0
    def load(self, data):

        data = replace_entities(data)
        try:
            BeautifulSoup.__init__(self, data)
        except UnicodeEncodeError:
            self.error = PageUnicodeError()
            BeautifulSoup.__init__(self, "")
        except:
            self.error = PageParseError()
            BeautifulSoup.__init__(self, "")
コード例 #4
0
ファイル: page.py プロジェクト: karstenw/Library
    def load(self, data):

        data = replace_entities(data)
        try:
            BeautifulSoup.__init__(self, data)
        except UnicodeEncodeError:
            self.error = PageUnicodeError()
            BeautifulSoup.__init__(self, "")
        except:
            self.error = PageParseError()
            BeautifulSoup.__init__(self, "")
コード例 #5
0
ファイル: yahoo.py プロジェクト: tian2992/shoebot
    def _parse(self, e, tag):
        """ Parses the text data from an XML element defined by tag.
        """

        tags = e.getElementsByTagName(tag)
        children = tags[0].childNodes
        if len(children) != 1: return None
        assert children[0].nodeType == xml.dom.minidom.Element.TEXT_NODE

        s = children[0].nodeValue
        s = format_data(s)
        s = replace_entities(s)

        return s
コード例 #6
0
ファイル: yahoo.py プロジェクト: karstenw/Library
    def _parse(self, e, tag):

        """ Parses the text data from an XML element defined by tag.
        """

        tags = e.getElementsByTagName(tag)
        children = tags[0].childNodes
        if len(children) != 1:
            return None
        assert children[0].nodeType == xml.dom.minidom.Element.TEXT_NODE

        s = children[0].nodeValue
        s = format_data(s)
        s = replace_entities(s)

        return s