Next, I searched for an opensource java RSS reader..And got this tool..Then I probed much into that ....I downloaded that tool and added all the jar files(\informa-0.6.0\lib)in the classpath..(its easy to put all the jar files in the classpath if you use eclipse or netbeans or any other java IDE, instead of writing a batch file..)
----------------------------testRssFeed.java--------------------
import java.net.*;
import java.util.*;
import de.nava.informa.core.*;
import java.io.File;
import de.nava.informa.core.ChannelIF;
import de.nava.informa.impl.basic.ChannelBuilder;
import de.nava.informa.parsers.FeedParser;
public class testRssFeed
{
public static void main(String[] args) throws Exception
{
//File file=new File("c:\\test.rss");
//ChannelIF channel = FeedParser.parse(new ChannelBuilder(), file);
ChannelIF channel = FeedParser.parse(new ChannelBuilder(), new URL("http://feeds.feedburner.com/DuraiOnlyBlog"));
for (Iterator iter = channel.getItems().iterator();iter.hasNext();) {
ItemIF item = (ItemIF)iter.next();
System.out.println(item.getTitle());
System.out.println("----------------------------");
System.out.println(item.getLink());
System.out.println("----------------------------");
System.out.println(item.getDescription());
System.out.println("----------------------------");
System.out.println("----------------------------");
System.out.println(item.getDate());
System.out.println("----------------------------");
}
}
}
--------------------------------------------------------------------------------import java.util.*;
import de.nava.informa.core.*;
import java.io.File;
import de.nava.informa.core.ChannelIF;
import de.nava.informa.impl.basic.ChannelBuilder;
import de.nava.informa.parsers.FeedParser;
public class testRssFeed
{
public static void main(String[] args) throws Exception
{
//File file=new File("c:\\test.rss");
//ChannelIF channel = FeedParser.parse(new ChannelBuilder(), file);
ChannelIF channel = FeedParser.parse(new ChannelBuilder(), new URL("http://feeds.feedburner.com/DuraiOnlyBlog"));
for (Iterator iter = channel.getItems().iterator();iter.hasNext();) {
ItemIF item = (ItemIF)iter.next();
System.out.println(item.getTitle());
System.out.println("----------------------------");
System.out.println(item.getLink());
System.out.println("----------------------------");
System.out.println(item.getDescription());
System.out.println("----------------------------");
System.out.println("----------------------------");
System.out.println(item.getDate());
System.out.println("----------------------------");
}
}
}
Enable the above comment if you have the rss file in the local machine...That's also works fine..
Next, I have to convert this simple java file into thread based servlet(it has to check that URL regular interval of time)...After that I have to write a j2me application which fetches that servlet content and displayed in the mobile..So j2me application also thread based program..
Once I finished that code, I will upload here ..But that will take time,I think...Let's see..
No comments:
Post a Comment