* @param is The input source to parse.
* @return The RssDocument object structure.
* @throws RssParseException
*/
RssDocument parseRss(InputSource is) throws RssParseException{
document = new RssDocument();
namespaces = new Vector();
characters = new StringBuffer();
parser = new SAXParser();
parser.setContentHandler(this);
parser.setErrorHandler(this);
try{
parser.parse(is);
}
catch(SAXException e){
cleanUp();
if(e.getException() instanceof RssParseException){
throw (RssParseException)e.getException();
}
else{
throw new RssParseException(e.getException());
}
}
catch(IOException e){
cleanUp();
throw new RssParseException(e);
}
// local reference to the doc that will be returned, before cleanup
RssDocument returnDoc = document;
// release all local objects for gc
cleanUp();
return returnDoc;
}