RSS API methode gibt unerwünschte Daten aus?

will2k

Mitglied
Hallo,

Code:
public class FeedReader
{
	@SuppressWarnings("unchecked")
	public static void main(String[] args) {
		try {
			URL feedUrl = new URL("http://www.softpedia.com/backend.xml");
			SyndFeedInput input = new SyndFeedInput();
			SyndFeed feed = input.build(new XmlReader(feedUrl)); 
	        Iterator items = feed.getEntries().iterator();       
	        while (items.hasNext())
	        { 
	            SyndEntry item = (SyndEntry)items.next(); 
	            System.out.println("Title: " + item.getTitle());            
	            System.out.println("Link: " + item.getLink());
	            System.out.println("Date: " + item.getPublishedDate());
	            System.out.println("Description: " + item.getDescription());
	        }
			
		}
		catch (Exception e)
		{
			e.printStackTrace();
		}
	}
}

Ausgabe:

Code:
Title: Delsi 2.0 (Trial)
Link: http://www.softpedia.com/get/Programming/Components-Libraries/Delsi.shtml
Date: Thu May 08 12:09:01 CEST 2008
Description: SyndContentImpl.value=Enables providers to develop simulation applications and sell them to their own customers.
SyndContentImpl.interface=interface com.sun.syndication.feed.synd.SyndContent
SyndContentImpl.type=text/html
SyndContentImpl.mode=null

Die Description sollte mir eigentlich kein SyndContentImpl Gedöns ausgeben, dennoch kommts, warum?

ok getValue() auf getDescription löst die SAche...

dennoch bekomme ich diese FEhlermeldung:

wo habe ich denn einen ungültigen index?

Code:
java.lang.IndexOutOfBoundsException: Invalid index
	at javax.swing.DefaultRowSorter.convertRowIndexToModel(Unknown Source)
	at javax.swing.JTable.convertRowIndexToModel(Unknown Source)
	at javax.swing.JTable.setValueAt(Unknown Source)
	at RssPanel.<init>(RssPanel.java:77)

Code:

try {
URL feedUrl = new URL("http://www.softpedia.com/backend.xml");
SyndFeedInput input = new SyndFeedInput();
SyndFeed feed = input.build(new XmlReader(feedUrl));
Iterator<?> items = feed.getEntries().iterator();
int i = 0;
while (items.hasNext())
{
SyndEntry item = (SyndEntry)items.next();
table.setValueAt(item.getTitle(),i,0);
table.setValueAt(item.getLink(),i,1);
table.setValueAt(item.getPublishedDate(),i,2);
table.setValueAt(item.getDescription().getValue(),i,3);

i++;
}

} catch (Exception e) {
e.printStackTrace();
}
 
Zuletzt bearbeitet:
Zurück