Пример #1
0
    def parse_message(self, tree, provider):
        itemList = []
        try:
            for entry in tree.findall(self.qname('entry', self.ATOM_NS)):
                item = {}
                self.set_item_defaults(item)
                self.parse_content_management(item, entry)
                self.parse_news_management(item, entry)
                item['body_html'] = self.get_elem_content(entry.find(self.qname('content', self.ATOM_NS)))
                itemList.append(item)
            return itemList

        except Exception as ex:
            raise ParserError.wennParserError(ex, provider)
Пример #2
0
    def parse(self, xml, provider=None):
        itemList = []
        try:
            for entry in xml.findall(self.qname('entry', self.ATOM_NS)):
                item = {}
                self.set_item_defaults(item)
                self.parse_content_management(item, entry)
                self.parse_news_management(item, entry)
                item['body_html'] = self.get_elem_content(entry.find(self.qname('content', self.ATOM_NS)))
                itemList.append(item)
            return itemList

        except Exception as ex:
            raise ParserError.wennParserError(ex, provider)
Пример #3
0
    def parse(self, xml, provider=None):
        itemList = []
        try:
            for entry in xml.findall(self.qname('entry', self.ATOM_NS)):
                item = {}
                self.set_item_defaults(item)
                self.parse_content_management(item, entry)
                self.parse_news_management(item, entry)
                item['body_html'] = self.get_elem_content(entry.find(self.qname('content', self.ATOM_NS)))
                item['body_html'] = item['body_html'].replace('\n\n  ', '</p><p>').replace('\n', '<br>')
                item['body_html'] = '<p>' + item['body_html'] + '</p>'
                itemList.append(item)
            return itemList

        except Exception as ex:
            raise ParserError.wennParserError(ex, provider)
Пример #4
0
    def parse(self, xml, provider=None):
        itemList = []
        try:
            for entry in xml.findall(self.qname("entry", self.ATOM_NS)):
                item = {}
                self.set_item_defaults(item)
                self.parse_content_management(item, entry)
                self.parse_news_management(item, entry)
                item["body_html"] = self.get_elem_content(
                    entry.find(self.qname("content", self.ATOM_NS)))
                item["body_html"] = item["body_html"].replace(
                    "\n\n  ", "</p><p>").replace("\n", "<br>")
                item["body_html"] = "<p>" + item["body_html"] + "</p>"
                itemList.append(item)
            return itemList

        except Exception as ex:
            raise ParserError.wennParserError(ex, provider)