File |
Line |
org\apache\commons\feedparser\test\DebugPerformance.java |
42 |
org\apache\commons\feedparser\test\TestPerformance.java |
48 |
public static void testSAX() throws Exception {
if ( parser == null ) {
parser = SAXParserFactory.newInstance().newSAXParser();
//need to enable SAX2 locals and namespace
parser.getXMLReader().setFeature( "http://xml.org/sax/features/namespaces", true );
}
org.apache.commons.feedparser.sax.RSSFeedParser handler =
new org.apache.commons.feedparser.sax.RSSFeedParser();
handler.listener = new DefaultFeedParserListener() {
public void onChannel( FeedParserState state,
String title,
String link,
String description ) throws FeedParserException {
// System.out.println( "onChannel: title: " + title );
}
public void onItem( FeedParserState state,
String title,
String link,
String description,
String permalink ) throws FeedParserException {
// System.out.println( "onItem: title: " + title );
}
public void onItemEnd() throws FeedParserException {
// System.out.println( "onItemEnd");
}
};
String resource = "file:/home/burton/index.rss";
ResourceRequest request = ResourceRequestFactory
.getResourceRequest( resource );
parser.parse( request.getInputStream(), handler );
}
public static void testDefault() throws Exception {
|