I have made a RSS reader and could use some help on small problem. When the rss XML is set up like this:
<link>http://www.grants.gov/search/search.do?mode=VIEW&oppId=98616</link>
my reader can pull the link fine.
But some feed I am trying to read are set up like:
<link>
http://www.ornl.gov/info/ornlreview/v44_1_11/article06.shtml
</link>
which causes my reader to miss the link.
I have narrowed the problem down to:
@Override
public void characters(char[] ch, int start, int length)
{
// TODO Auto-generated method stub
String strCharacters = new String(ch,start,length);
if (itemFound==true){
// "item" tag found, it's item's parameter
switch(currentState){
case state_title:
item.setTitle(strCharacters);
break;
case state_description:
item.setDescription(strCharacters);
break;
case state_link:
item.setLink(strCharacters);
break;
case state_pubdate:
item.setPubdate(strCharacters);
break;
default:
break;
}
}
The strCharacters pulls the string in the current row, but with the RSS with a space it just pulls whitespace. Any ideas on how to get it to skip the white space and pull the link on the next line?
Your parser looks weird, try doing this instead:
That way you wait until the content is completely consumed, instead of just reading one line of text.