This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds and have James Denton on-line!
See this thread for details.
Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Rss Feed in jsp  RSS feed

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
friends pls.. help me out regarding Rss feed

i was tried a simple example to retrive data from the given rss feed by a news site by using console application but iam unable to run it
it is compiled successfully. while running the program it is showing the following error.

C:\Rssfeed>java testfeed
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/lo
gging/LogFactory
at de.nava.informa.utils.FormatDetector.<clinit>(FormatDetector.java:50)

at testfeed.main(testfeed.java:15)

it is giving error in the informa package class..

plss... help me out...

my code is as follows

import de.nava.informa.core.*;
import de.nava.informa.utils.*;
import de.nava.informa.impl.basic.*;
import de.nava.informa.utils.*;
import de.nava.informa.utils.FormatDetector;
import java.io.*;
import java.net.*;
import java.util.*;
public class testfeed
{
public static void main(String args[])
{
try {
URL feed = new URL("file:/C:/Rssfeed/testfeed.rss");
ChannelFormat format = FormatDetector.getFormat(feed);
ChannelParserCollection parsers = ChannelParserCollection.getInstance();

ChannelParserIF parser = parsers.getParser(format, feed);

parser.setBuilder(new ChannelBuilder());
ChannelIF channel = parser.parse();

for (Iterator iter = channel.getItems().iterator(); iter.hasNext();)
{
ItemIF item = (ItemIF)iter.next();
System.out.println(item.getTitle());
}
} catch (MalformedURLException mue)
{
mue.printStackTrace();}
catch (UnsupportedFormatException ufe)
{
ufe.printStackTrace();
}
catch (ParseException pe)
{
pe.printStackTrace();
}
catch(Exception e)
{e.printStackTrace();}
}
}

testfeed.rss

<?xml version="1.0"? >
<!-- The version of RSS we are using -->
<rss version="0.91">
<!-- Information about our channel -->
<channel>
<title>Random News</title>
<link>http://www.randomnews.com/</link>
<description>
Random news from the random news website!
</description>
<language>en-us</language>
<copyright>Copyright: (C) 2003 Random News.com</copyright>

<image>
<title>Random News Logo</title>
<url>http://randomnews.org/images/logo88x33.gif</url>
<link> http://randomnews.org/</link>
</image>

<item>
<title>News piece one</title>
<link>http://randomnews.org/getnews.pl?article=1</link>
</item>

<item>
<title>News piece two</title>
<link>http://randomnews.org/getnews.pl?article=2</link>
</item>
</channel>
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!