Skip to content

Instantly share code, notes, and snippets.

@tonycosentini
Created November 22, 2011 17:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tonycosentini/1386201 to your computer and use it in GitHub Desktop.
Save tonycosentini/1386201 to your computer and use it in GitHub Desktop.
public RssParser(String feedURLString) throws Exception {
HttpClient client = new DefaultHttpClient();
HttpGet request = new HttpGet(feedURLString);
HttpResponse response = client.execute(request);
SAXParserFactory f = SAXParserFactory.newInstance();
SAXParser parser = f.newSAXParser();
XMLReader reader = parser.getXMLReader();
RssHandler handler = new RssHandler();
reader.setContentHandler(handler);
reader.parse(new InputSource(new InputStreamReader(response.getEntity().getContent())));
mItems = handler.mItems;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment