Sign In/My Account | View Cart  
advertisement


Listen Print Discuss

ROME in a Day: Parse and Publish Feeds in Java
by Mark Woodman | Pages: 1, 2, 3, 4, 5, 6

Try It Out

Compile FeedWarmer.java and take your new creation for a spin. The output XML should now have a footer added to each feed item or entry, as shown in Figure 2:

Figure 2
Figure 2. Our FeedWarmer class has added a footer to an RSS item. Click image for full-size screenshot.

Here is a sample of XML that has been run through the FeedWarmer. Note that the <description /> element is untouched, but the <content:encoded /> element has our footer at the end:

<div id='feedwarmer'><hr/>
   <i>Getting Warmer:</i>
   
   <a href='mailto:?subject=ROME 0.8 Released&body=Check this 
   out: http://inkblots.markwoodman.com/2006/02/02/rome-08-released/' 
   >Email this</a> | 
   
   <a href='http://del.icio.us/post/?url=http://inkblots.markwoodman.
   com/2006/02/02/rome-08-released/&title=ROME 0.8 Released'>Add to 
   delicious</a> | 
   
   <a href='http://blogsearch.google.com/blogsearch?hl=en&q=ROME 
   0.8 Released'>Blog Search this</a>
</div>

Moving On

As you can see, ROME can be a valuable way to parse and publish feeds with very little effort. It is fair to say, however, that there is much more to the library than we have covered here. ROME provides support for enclosures, podcasting, and a good deal more. If you would like to see more code examples and tutorials, be sure to visit the ROME Tutorials page.

Finally, if you get stuck and need a hand implementing ROME in your projects, the user and developer groups are always willing to lend a hand. (Full disclosure: I'm on the developer team.) Feel free to stop by the wiki site, join the mailing lists, and get involved.


Comment on this articleShare your experience in our forums.
(* You must be a
member of XML.com to use this feature.)
Comment on this Article


Titles Only Titles Only Newest First
  • Help Needed!!
    2008-01-11 17:02:14 RajKumarSingh [Reply]

    Hi


    After reading the article I understand that we can use ROME API to read a RSS feed and update it or create a new RSS feed. However, forgive me for my dumb question, is there any way we can use ROME to scrap a HTML page and find out which elements in that page is RSS enabled?


    Thanks
    Raj

  • Minor Correction
    2006-02-28 05:25:07 kebernet [Reply]

    This appears in a comment to Marks example, but the valid options for feed types should be rss_0.91N and rss_0.91U, representing the slightly differing specs proffered by Netstape and Userland respectively.

  • Excellent article
    2006-02-24 01:48:59 babelex [Reply]

    Really good article and timely aswell. I just started using Rome this week!!


    I wasn't aware of the content modules and the issues they help solve escaped vs content encoded etc..


    regards
    Al


  • Very nice!
    2006-02-22 19:30:45 ericlunt [Reply]

    I love it! Great tutorial, Mark. It really shows off the power of the ROME library. FeedBurner uses Java all the way through ... if we were starting development on it today, I'd be seriously tempted to use this library to get a head start.


    Eric Lunt
    CTO, FeedBurner