org.apache.commons.feedparser
Class Test

java.lang.Object
  extended by org.apache.commons.feedparser.DefaultFeedParserListener
      extended by org.apache.commons.feedparser.Test
All Implemented Interfaces:
ContentFeedParserListener, FeedLifecycleListener, FeedParserListener, MetaFeedParserListener, ModContentFeedParserListener, XHTMLFeedParserListener

public class Test
extends DefaultFeedParserListener
implements FeedParserListener, ModContentFeedParserListener, XHTMLFeedParserListener

This FeedParser implementation is based on JDOM and Jaxen and is based around XPath and JDOM iteration. While the implementation is straight forward it has not been optimized for performance. A SAX based parser would certainly be less memory intensive but with the downside of being harder to develop.

Version:
$Id: Test.java 373614 2006-01-30 22:31:21Z mvdb $
Author:
Kevin A. Burton (burtonator)

Constructor Summary
Test()
           
 
Method Summary
 void finished()
          Called when the feed has finished parsing.
 void init()
          Called prior to event parsing to signal the parsing of a new feed.
static void main(String[] args)
           
 void onChannel(FeedParserState state, String title, String link, String description)
          Called when a channel item is found.
 void onChannelEnd()
           
 void onContentEncoded(FeedParserState state, String value)
           
 void onContentEncodedEnd()
           
 void onContentItem(FeedParserState state, String format, String encoding, org.jdom.Element value)
           
 void onContentItemEnd()
           
 void onImage(FeedParserState state, String title, String link, String url)
          Called when an RSS image is found.
 void onImageEnd()
           
 void onItem(FeedParserState state, String title, String link, String description, String permalink)
          Called when an RSS item or Atom entry is found.
 void onItemEnd()
           
 void onXHTMLBody(FeedParserState state, org.jdom.Element value)
           
 void onXHTMLBodyEnd()
           
 void setContext(Object context)
          Set this context that this FeedParserListener is executing within.
 
Methods inherited from class org.apache.commons.feedparser.DefaultFeedParserListener
getContext, onAuthor, onAuthorEnd, onComments, onCommentsEnd, onCommentsFeed, onCommentsFeedEnd, onContent, onContentEnd, onCopyright, onCopyrightEnd, onCreated, onCreatedEnd, onFeedVersion, onGenerator, onGeneratorEnd, onGUID, onGUIDEnd, onIssued, onIssuedEnd, onLocale, onLocaleEnd, onSubject, onSubjectEnd
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.commons.feedparser.FeedParserListener
onFeedVersion
 
Methods inherited from interface org.apache.commons.feedparser.FeedLifecycleListener
getContext
 

Constructor Detail

Test

public Test()
Method Detail

init

public void init()
Called prior to event parsing to signal the parsing of a new feed.

Specified by:
init in interface FeedLifecycleListener
Overrides:
init in class DefaultFeedParserListener

setContext

public void setContext(Object context)
Description copied from interface: FeedLifecycleListener
Set this context that this FeedParserListener is executing within. This can be used with anonymous listeners to pass contextual information about threads they are working within, etc.

Specified by:
setContext in interface FeedLifecycleListener
Overrides:
setContext in class DefaultFeedParserListener

onChannel

public void onChannel(FeedParserState state,
                      String title,
                      String link,
                      String description)
Called when a channel item is found.

Specified by:
onChannel in interface FeedParserListener
Overrides:
onChannel in class DefaultFeedParserListener

onChannelEnd

public void onChannelEnd()
Specified by:
onChannelEnd in interface FeedParserListener
Overrides:
onChannelEnd in class DefaultFeedParserListener

onImage

public void onImage(FeedParserState state,
                    String title,
                    String link,
                    String url)
Called when an RSS image is found.

Specified by:
onImage in interface FeedParserListener
Overrides:
onImage in class DefaultFeedParserListener

onImageEnd

public void onImageEnd()
Specified by:
onImageEnd in interface FeedParserListener
Overrides:
onImageEnd in class DefaultFeedParserListener

onItem

public void onItem(FeedParserState state,
                   String title,
                   String link,
                   String description,
                   String permalink)
Called when an RSS item or Atom entry is found.

Specified by:
onItem in interface FeedParserListener
Overrides:
onItem in class DefaultFeedParserListener

onItemEnd

public void onItemEnd()
Specified by:
onItemEnd in interface FeedParserListener
Overrides:
onItemEnd in class DefaultFeedParserListener

finished

public void finished()
Description copied from interface: FeedLifecycleListener
Called when the feed has finished parsing.

Specified by:
finished in interface FeedLifecycleListener
Overrides:
finished in class DefaultFeedParserListener

onContentEncoded

public void onContentEncoded(FeedParserState state,
                             String value)
Specified by:
onContentEncoded in interface ModContentFeedParserListener
Overrides:
onContentEncoded in class DefaultFeedParserListener

onContentEncodedEnd

public void onContentEncodedEnd()
Specified by:
onContentEncodedEnd in interface ModContentFeedParserListener
Overrides:
onContentEncodedEnd in class DefaultFeedParserListener

onContentItem

public void onContentItem(FeedParserState state,
                          String format,
                          String encoding,
                          org.jdom.Element value)
Specified by:
onContentItem in interface ModContentFeedParserListener
Overrides:
onContentItem in class DefaultFeedParserListener

onContentItemEnd

public void onContentItemEnd()
Specified by:
onContentItemEnd in interface ModContentFeedParserListener
Overrides:
onContentItemEnd in class DefaultFeedParserListener

onXHTMLBody

public void onXHTMLBody(FeedParserState state,
                        org.jdom.Element value)
Specified by:
onXHTMLBody in interface XHTMLFeedParserListener
Overrides:
onXHTMLBody in class DefaultFeedParserListener

onXHTMLBodyEnd

public void onXHTMLBodyEnd()
Specified by:
onXHTMLBodyEnd in interface XHTMLFeedParserListener
Overrides:
onXHTMLBodyEnd in class DefaultFeedParserListener

main

public static void main(String[] args)


Copyright © 2001-2010 The Apache Software Foundation. All Rights Reserved.