com.sun.syndication.io
Interface FeedParser

All Known Implementing Classes:
Atom03Parser, RSS090Parser

public interface FeedParser

Parses an XML document (JDOM) into a feed bean.

FeedParser instances must thread safe.

TODO: explain how developers can plugin their own implementations.

Author:
Alejandro Abdelnur

Method Summary
 java.lang.String getType()
          Returns the type of feed the parser handles.
 boolean isMyType(org.jdom.Document document)
          Inspects an XML Document (JDOM) to check if it can parse it.
 AbstractFeed parse(org.jdom.Document document, boolean validate)
          Parses an XML document (JDOM Document) into a feed bean.
 

Method Detail

getType

public java.lang.String getType()
Returns the type of feed the parser handles.

Returns:
the type of feed the parser handles.
See Also:
for details on the format of this string.


isMyType

public boolean isMyType(org.jdom.Document document)
Inspects an XML Document (JDOM) to check if it can parse it.

It checks if the given document if the type of feeds the parser understands.

Parameters:
document - XML Document (JDOM) to check if it can be parsed by this parser.
Returns:
true if the parser know how to parser this feed, false otherwise.

parse

public AbstractFeed parse(org.jdom.Document document,
                          boolean validate)
                   throws java.lang.IllegalArgumentException,
                          FeedException
Parses an XML document (JDOM Document) into a feed bean.

Parameters:
document - XML document (JDOM) to parse.
validate - indicates if the feed should be strictly validated (NOT YET IMPLEMENTED).
Returns:
the resulting feed bean.
Throws:
java.lang.IllegalArgumentException - thrown if the parser cannot handle the given feed type.
FeedException - thrown if a feed bean cannot be created out of the XML document (JDOM).


Copyright © 2004 Sun Microsystems. All Rights Reserved.