View Javadoc
1 package net.sf.flock.support; 2 3 import java.util.Collection; 4 import java.util.Iterator; 5 6 import net.sf.flock.ItemI; 7 import org.jdom.DocType; 8 import org.jdom.Document; 9 import org.jdom.Element; 10 11 /*** 12 * @version $Revision: 1.4 $ 13 * @author $Author: phraktle $ 14 */ 15 public class Rss091Export { 16 17 public static final String PUBLIC_ID = 18 "-//Netscape Communications//DTD RSS 0.91//EN"; 19 public static final String SYSTEM_ID = 20 "http://my.netscape.com/publish/formats/rss-0.91.dtd"; 21 public static final String RSS_VERSION = "0.91"; 22 23 /*** 24 * Constructor for Rss091Export. 25 */ 26 public Rss091Export() { 27 } 28 29 public Document export(String title, Collection articles) { 30 31 // ---- 32 Element rootElem = new Element("rss"); 33 rootElem.setAttribute("version", RSS_VERSION); 34 Element channelElem = new Element("channel"); 35 36 channelElem.addContent( 37 new Element("title").setText(title)); 38 39 /* 40 /* 41 * -----------NINCS : getDescription, getSite, getLanguage metodusunk, ami ---------- 42 * --------- raadasul Title helyett ez nem tul jo ... 43 * 44 * 45 channelElem.addContent( 46 new Element("description").setText(category.getDescription())); 47 if (category.getSite() != null) { 48 channelElem.addContent( 49 new Element("link").setText(category.getSite().toString())); 50 } 51 if (category.getLanguage() != null) { 52 channelElem.addContent( 53 new Element("language").setText(category.getLanguage())); 54 } 55 */ 56 Iterator it = articles.iterator(); 57 while (it.hasNext()) { 58 ItemI article = (ItemI) it.next(); 59 Element itemElem = new Element("item"); 60 itemElem.addContent(new Element("title").setText(article.getTitle())); 61 if (article.getLink()!=null) { 62 itemElem.addContent( new Element("link").setText(article.getLink().toString()) ); 63 } 64 itemElem.addContent( 65 new Element("description").setText(article.getDescription())); 66 channelElem.addContent(itemElem); 67 } 68 69 // if (channel.getImage() != null) { 70 // channelElem.addContent(channel.getImage().getElement()); 71 // } 72 // if (channel.getTextInput() != null) { 73 // channelElem.addContent(channel.getTextInput().getElement()); 74 // } 75 76 /* 77 * -----------NINCS COPYRIGHT MEZONK SE ----------------------- 78 if (category.getCopyright() != null) { 79 channelElem.addContent( 80 new Element("copyright").setText(category.getCopyright())); 81 } 82 */ 83 // we have all together for the channel definition 84 rootElem.addContent(channelElem); 85 // --- 86 DocType docType = new DocType("rss", PUBLIC_ID, SYSTEM_ID); 87 Document doc = new Document(rootElem, docType); 88 return doc; 89 } 90 91 }

This page was automatically generated by Maven