def write(self, outfile, encoding):
     handler = SimplerXMLGenerator(outfile, encoding)
     handler.startDocument()
     handler.startElement(u'feed', self.root_attributes())
     self.add_root_elements(handler)
     self.write_items(handler)
     handler.endElement(u"feed")
示例#2
0
 def write(self, outfile, encoding):
     handler = SimplerXMLGenerator(outfile, encoding)
     handler.startDocument()
     if self.feed['language'] is not None:
         handler.startElement(u"feed", {u"xmlns": self.ns, u"xml:lang": self.feed['language']})
     else:
         handler.startElement(u"feed", {u"xmlns": self.ns})
     handler.addQuickElement(u"title", self.feed['title'])
     handler.addQuickElement(u"link", "", {u"rel": u"alternate", u"href": self.feed['link']})
     if self.feed['feed_url'] is not None:
         handler.addQuickElement(u"link", "", {u"rel": u"self", u"href": self.feed['feed_url']})
     handler.addQuickElement(u"id", self.feed['link'])
     handler.addQuickElement(u"updated", rfc3339_date(self.latest_post_date()).decode('ascii'))
     if self.feed['author_name'] is not None:
         handler.startElement(u"author", {})
         handler.addQuickElement(u"name", self.feed['author_name'])
         if self.feed['author_email'] is not None:
             handler.addQuickElement(u"email", self.feed['author_email'])
         if self.feed['author_link'] is not None:
             handler.addQuickElement(u"uri", self.feed['author_link'])
         handler.endElement(u"author")
     if self.feed['subtitle'] is not None:
         handler.addQuickElement(u"subtitle", self.feed['subtitle'])
     for cat in self.feed['categories']:
         handler.addQuickElement(u"category", "", {u"term": cat})
     if self.feed['feed_copyright'] is not None:
         handler.addQuickElement(u"rights", self.feed['feed_copyright'])
     self.write_items(handler)
     handler.endElement(u"feed")
 def write(self, outfile, encoding):
     handler = SimplerXMLGenerator(outfile, encoding)
     handler.startDocument()
     if self.feed['language'] is not None:
         handler.startElement(u"feed", {u"xmlns": self.ns, u"xml:lang": self.feed['language']})
     else:
         handler.startElement(u"feed", {u"xmlns": self.ns})
     handler.addQuickElement(u"title", self.feed['title'])
     handler.addQuickElement(u"link", "", {u"rel": u"alternate", u"href": self.feed['link']})
     if self.feed['feed_url'] is not None:
         handler.addQuickElement(u"link", "", {u"rel": u"self", u"href": self.feed['feed_url']})
     handler.addQuickElement(u"id", self.feed['link'])
     handler.addQuickElement(u"updated", rfc3339_date(self.latest_post_date()).decode('ascii'))
     if self.feed['author_name'] is not None:
         handler.startElement(u"author", {})
         handler.addQuickElement(u"name", self.feed['author_name'])
         if self.feed['author_email'] is not None:
             handler.addQuickElement(u"email", self.feed['author_email'])
         if self.feed['author_link'] is not None:
             handler.addQuickElement(u"uri", self.feed['author_link'])
         handler.endElement(u"author")
     if self.feed['subtitle'] is not None:
         handler.addQuickElement(u"subtitle", self.feed['subtitle'])
     for cat in self.feed['categories']:
         handler.addQuickElement(u"category", "", {u"term": cat})
     self.write_items(handler)
     handler.endElement(u"feed")
 def write(self, outfile, encoding):
     handler = SimplerXMLGenerator(outfile, encoding)
     handler.startDocument()
     handler.startElement(u"rss", self.rss_attributes())
     handler.startElement(u"channel", self.root_attributes())
     self.add_root_elements(handler)
     self.write_items(handler)
     self.endChannelElement(handler)
     handler.endElement(u"rss")
 def write(self, outfile, encoding):
     handler = SimplerXMLGenerator(outfile, encoding)
     handler.startDocument()
     handler.startElement(u"rss", {u"version": self._version})
     handler.startElement(u"channel", {})
     handler.addQuickElement(u"title", self.feed['title'])
     handler.addQuickElement(u"link", self.feed['link'])
     handler.addQuickElement(u"description", self.feed['description'])
     if self.feed['language'] is not None:
         handler.addQuickElement(u"language", self.feed['language'])
     for cat in self.feed['categories']:
         handler.addQuickElement(u"category", cat)
     self.write_items(handler)
     self.endChannelElement(handler)
     handler.endElement(u"rss")
示例#6
0
 def write(self, outfile, encoding):
     handler = SimplerXMLGenerator(outfile, encoding)
     handler.startDocument()
     handler.startElement(u"rss", {u"version": self._version})
     handler.startElement(u"channel", {})
     handler.addQuickElement(u"title", self.feed['title'])
     handler.addQuickElement(u"link", self.feed['link'])
     handler.addQuickElement(u"description", self.feed['description'])
     if self.feed['language'] is not None:
         handler.addQuickElement(u"language", self.feed['language'])
     for cat in self.feed['categories']:
         handler.addQuickElement(u"category", cat)
     if self.feed['feed_copyright'] is not None:
         handler.addQuickElement(u"copyright", self.feed['feed_copyright'])
     handler.addQuickElement(u"lastBuildDate", rfc2822_date(self.latest_post_date()).decode('ascii'))
     if self.feed['ttl'] is not None:
         handler.addQuickElement(u"ttl", self.feed['ttl'])
     self.write_items(handler)
     self.endChannelElement(handler)
     handler.endElement(u"rss")
示例#7
0
 def write(self, outfile, encoding):
     handler = SimplerXMLGenerator(outfile, encoding)
     handler.startDocument()
     handler.startElement(u"rss", {u"version": self._version})
     handler.startElement(u"channel", {})
     handler.addQuickElement(u"title", self.feed['title'])
     handler.addQuickElement(u"link", self.feed['link'])
     handler.addQuickElement(u"description", self.feed['description'])
     if self.feed['language'] is not None:
         handler.addQuickElement(u"language", self.feed['language'])
     for cat in self.feed['categories']:
         handler.addQuickElement(u"category", cat)
     if self.feed['feed_copyright'] is not None:
         handler.addQuickElement(u"copyright", self.feed['feed_copyright'])
     handler.addQuickElement(
         u"lastBuildDate",
         rfc2822_date(self.latest_post_date()).decode('ascii'))
     if self.feed['ttl'] is not None:
         handler.addQuickElement(u"ttl", self.feed['ttl'])
     self.write_items(handler)
     self.endChannelElement(handler)
     handler.endElement(u"rss")