Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

RSS using ROME. Need to extract XML tag information

Posted on 2006-06-08
6
Medium Priority
?
305 Views
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">http://www.publisher.com/test.aspx?ID=15731</link>
      <pubDate>07-06-06 17:37</pubDate>
      <category>Business News</category>
      <source>http://www.publisher.com/test.aspx?ID=15700</source>
    </item>

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.
0
Comment
Question by:adrianbasheer
  • 2
  • 2
5 Comments
 
LVL 30

Expert Comment

by:Mayank S
ID: 16861169
Did you use the getContents () method?
0
 

Author Comment

by:adrianbasheer
ID: 16868005
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).

0
 
LVL 30

Expert Comment

by:Mayank S
ID: 16868017
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.
0
 

Author Comment

by:adrianbasheer
ID: 16910369
Hello,

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.
0
 

Accepted Solution

by:
CetusMOD earned 0 total points
ID: 17152185
PAQed with points refunded (500)

CetusMOD
Community Support Moderator
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
The viewer will learn how to dynamically set the form action using jQuery.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
Suggested Courses
Course of the Month13 days, 23 hours left to enroll

581 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