Back to project page HapiPodcastJ.
The source code is released under:
GNU General Public License
If you think the Android project HapiPodcastJ listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package info.xuluan.podcast.parser; /* w w w.j ava 2 s . c o m*/ import java.io.IOException; import java.io.InputStream; import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; import org.xml.sax.SAXException; import org.xml.sax.helpers.DefaultHandler; public class FeedParser { static final FeedParser instance = new FeedParser(); public static FeedParser getDefault() { return instance; } SAXParserFactory saxParserFactory = SAXParserFactory.newInstance(); public FeedParser() { } public void parse(InputStream input,DefaultHandler handler){ try { SAXParser parser = saxParserFactory.newSAXParser(); parser.parse(input, handler); } catch (SAXException e) { e.printStackTrace(); throw new RuntimeException(e); } catch (IOException e) { throw new RuntimeException(e); } catch (ParserConfigurationException e) { throw new RuntimeException(e); } finally { if (input != null) { try { input.close(); } catch (IOException e) { } } } } }