Hello
I've checked everywhere for an answer to this but I just can't find it. I can't believe I'm the only one to have it.
I have written an RSS reader using SAX, like this
The RSS is sorted and stored in a database through the RSSHandler class.
The problem :
This works fine. Running under Wifi I get all the data back from the RSS. However, If I'm running using 3G and the signal strength is not so good, it returns maybe a few feeds from the RSS or in some cases no feeds at all.
The question :
Is there away to check is the entire RSS feed has been sorted and stored before it quits? I'm guessing that it loses connection during the RSSHandler class and so just returns what it's received, or maybe it's in the openStream(). Maybe even actually download the RSS to the cache and then use that?
Anyway any help would be appreciated.
Thanks
James
I've checked everywhere for an answer to this but I just can't find it. I can't believe I'm the only one to have it.
I have written an RSS reader using SAX, like this
Code:
try
{
// setup the url
URL url = new URL(urlToRssFeed);
// create the factory
SAXParserFactory factory = SAXParserFactory.newInstance();
// create a parser
SAXParser parser = factory.newSAXParser();
// create the reader (scanner)
XMLReader xmlreader = parser.getXMLReader();
// instantiate our handler
RSSHandler theRssHandler = new RSSHandler();
// assign our handler
xmlreader.setContentHandler(theRssHandler);
// get our data through the url class
InputSource is = new InputSource(url.openStream());
// perform the synchronous parse
xmlreader.parse(is);
// get the results - should be a fully populated RSSFeed instance,
// or null on error
return theRssHandler.getFeed();
}
catch (Exception ee)
{
// if you have a problem, simply return null
return null;
}
The RSS is sorted and stored in a database through the RSSHandler class.
The problem :
This works fine. Running under Wifi I get all the data back from the RSS. However, If I'm running using 3G and the signal strength is not so good, it returns maybe a few feeds from the RSS or in some cases no feeds at all.
The question :
Is there away to check is the entire RSS feed has been sorted and stored before it quits? I'm guessing that it loses connection during the RSSHandler class and so just returns what it's received, or maybe it's in the openStream(). Maybe even actually download the RSS to the cache and then use that?
Anyway any help would be appreciated.
Thanks
James