Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6009915
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:02:25+00:00 2026-05-23T02:02:25+00:00

I have made a RSS reader and could use some help on small problem.

  • 0

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&amp;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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T02:02:26+00:00Added an answer on May 23, 2026 at 2:02 am

    Your parser looks weird, try doing this instead:

      private StringBuilder builder;   
    
      @Override
      public void startDocument() throws SAXException {
        super.startDocument();
        builder = new StringBuilder();
      }
    
      @Override
      public void characters(char[] ch, int start, int length) throws SAXException {
        super.characters(ch, start, length);
        builder.append(ch, start, length);
      }
    
      public void endElement(String uri, String localName, String name) throws SAXException {
        if (currentState == state_link) {
          item.setLink(builder.toString().trim());
        }
        builder.setLength(0);
      }
    

    That way you wait until the content is completely consumed, instead of just reading one line of text.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: What is object serialization? I've made a small RSS Reader app using
this is the header of all the RSS feeds I use <?xml version=1.0 encoding=UTF-8?>
I have a basic RSS Reader I made from three20 tutorials using TTLauncherView as
I have made some select and checkboxes - like mac and so on... with
I have made a SVG image, or more like mini application, for viewing graphs
I have made some code which exports some details of a journal article to
I have made a user control in asp.net c#. Becuase of some data I
I have made this piece of code that makes a roll hover effect on
i have made user-register.tpl.php file. And i have set many text field in that.
I made an RSS reader using Zend's Zend_Feed_Rss object. It worked fine for me

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.