from java.net import URL from java.util import Date from de.nava.informa.impl.basic import Channel from de.nava.informa.impl.basic import Item from de.nava.informa.exporters import RSS_0_91_Exporter # create demo channel channel = Channel("The Great Demo Channel") item = Item("Bugo", "All about it!", URL("http://nava.de/huhu2002")) item.setFound(Date()) channel.addItem(item) # try to write out to file exp_file = "test-rss091.xml" print "Start to export channel to", exp_file exporter = RSS_0_91_Exporter(exp_file) exporter.write(channel) print "Exporting finished."
from java.net import URL from java.util import Date from de.nava.informa.impl.basic import Channel from de.nava.informa.impl.basic import Item def addItem(channel, title, descr, link): item = Item(title, descr, URL(link)) item.setFound(Date()) channel.addItem(item) # create demo channel channel = Channel("The Great Demo Channel") addItem(channel, "Bugo", "All about it!", "http://nava.de/huhu2002") addItem(channel, "Python", "Instant Python updated", "http://nava.de/I9") # convert to array items = channel.getItems().toArray() print "items", items new_item = Item("NN", "Fresh", URL("http://new.com")) new_items = [] new_items.append(new_item) for item in items: new_items.append(item) items = array(new_items, Object)