RSS using ROME. Need to extract XML tag information

Posted on 2006-06-08
Last Modified: 2013-11-19
I am using the ROME library to read an RSS stream. The items in the stream look something like:

    <item protectafeed="true">
      <title id="12931" info1="true" info2="2">hello</title>
      <description id="12931" info1="true" info2="2">How are you</description>
      <link publisherID="2"></link>
      <pubDate>07-06-06 17:37</pubDate>
      <category>Business News</category>

I am reading the stream into a com.sun.syndication.feed.synd.SyndFeed, and iterating through it using SyndEntry objects.

when I try to retrieve the title, I get "hello", however, I don't know how to obtain the values of id, info1 and info2, can anybody help please?

Thank you for your time.
Question by:adrianbasheer
    LVL 30

    Expert Comment

    Did you use the getContents () method?

    Author Comment

    Thank you for the quick reply.

    However, the getContents() method returns a list of SyndContentImpl objects.this allows me to getType() and getValue(), these give me respectively:

    "text/plain" and "How are you"

    What I want is the values of id, info1, info2. That is, had I been parsing the file myself using SAX, I would get these values in the Attributes paramter to the startElement() callback method.

    I could, of course, parse the buffer myself to get these, but then parsing would be done twice, once by me to get the attributes, and once by ROME to generate the SyndFeed (which I do need).

    LVL 30

    Expert Comment

    Well, I am not sure how to get the attributes using SyndFeed. You are right that its no use parsing it twice, once using SAX also. I'll see if I can find something in the API to get the attributes.

    Author Comment


    I ended up getting the Axis source code and finding out that the attributes that are not part of the RSS / Atom specifications are ignored. The best solution was to modify the Axis library itself, which seems to work well now.

    Thank you for you time. I guess This thread can now be closed.

    Accepted Solution

    PAQed with points refunded (500)

    Community Support Moderator

    Featured Post

    Hire Top Freelancers to Complete Java Projects

    Source the talented Expert Exchange community
    for top quality work on your Java projects.

    Hire the best. Collaborate easily. Get quality work.

    Join & Write a Comment

    Suggested Solutions

    This article covers the basics of the Sass, which is a CSS extension language. You will learn about variables, mixins, and nesting.
    Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
    This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
    The viewer will learn how to dynamically set the form action using jQuery.

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now