Top Fields Constructors Methods
com.rometools.rome.io.impl

public Class RSS090Parser

extends BaseWireFeedParser
Class Inheritance
Known Direct Subclasses
com.rometools.rome.io.impl.RSS091UserlandParser, com.rometools.rome.io.impl.RSS10Parser
Imports
java.util.ArrayList, .Iterator, .List, .Locale, org.jdom2.Document, .Element, .Namespace, com.rometools.rome.feed.WireFeed, com.rometools.rome.feed.module.Module, com.rometools.rome.feed.rss.Channel, .Image, .Item, .TextInput, com.rometools.rome.io.FeedException

Field Summary

Modifier and TypeField and Description
private static final Namespace
private static final String
private static final Namespace
private static final String
private static final Namespace
private static final String

Constructor Summary

AccessConstructor and Description
public
protected
RSS090Parser(final String type, final Namespace ns)

Method Summary

Modifier and TypeMethod and Description
protected Namespace

Returns:

returns the EMPTY namespace.
getContentNamespace
()

Returns the namespace used by Content Module elements in document.

protected Element
getImage(final Element rssRoot)

This method exists because RSS0.90 and RSS1.0 have the 'image' element under the root elemment.

protected List<Element>
getItems(final Element rssRoot)

This method exists because RSS0.90 and RSS1.0 have the 'item' elements under the root elemment.

protected Namespace

Returns:

returns the EMPTY namespace.
getRDFNamespace
()

Returns the namespace used by RDF elements in document of the RSS version the parser supports.

protected Namespace

Returns:

returns the EMPTY namespace.
getRSSNamespace
()

Returns the namespace used by RSS elements in document of the RSS version the parser supports.

protected Element
getTextInput(final Element rssRoot)

This method exists because RSS0.90 and RSS1.0 have the 'textinput' element under the root elemment.

public boolean
isMyType(final Document
XML Document (JDOM) to check if it can be parsed by this parser.
document
)

Implements com.rometools.rome.io.WireFeedParser.isMyType.

Inspects an XML Document (JDOM) to check if it can parse it.
public WireFeed
parse(final Document
XML document (JDOM) to parse.
document
,
final boolean
indicates if the feed should be strictly validated (NOT YET IMPLEMENTED).
validate
,
final Locale locale)

Implements com.rometools.rome.io.WireFeedParser.parse.

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

Returns:

the parsed Channel bean.
parseChannel
(final Element
the root element of the RSS document to parse.
rssRoot
,
final Locale locale)

Parses the root element of an RSS document into a Channel bean.

protected Image

Returns:

the parsed image bean.
parseImage
(final Element
the root element of the RSS document to parse for image information.
rssRoot
)

Parses the root element of an RSS document looking for image information.

protected Item

Returns:

the parsed RSSItem bean.
parseItem
(final Element
the root element of the RSS document in case it's needed for context.
rssRoot
,
final Element
the item element to parse.
eItem
,
final Locale locale)

Parses an item element of an RSS document looking for item information.

protected List<Item>

Returns:

a list with all the parsed RSSItem beans.
parseItems
(final Element
the root element of the RSS document to parse for all items information.
rssRoot
,
final Locale locale)

Parses the root element of an RSS document looking for all items information.

protected TextInput

Returns:

the parsed RSSTextInput bean.
parseTextInput
(final Element
the root element of the RSS document to parse for text-input information.
rssRoot
)

Parses the root element of an RSS document looking for text-input information.

protected void
validateFeed(final Document document)

Inherited from com.rometools.rome.io.impl.BaseWireFeedParser:
extractForeignMarkupgetAttributegetAttributeValuegetStyleSheetgetTypeparseFeedModulesparseItemModulesparsePersonModules

Field Detail

CONTENT_NSback to summary
private static final Namespace CONTENT_NS
CONTENT_URIback to summary
private static final String CONTENT_URI
RDF_NSback to summary
private static final Namespace RDF_NS
RDF_URIback to summary
private static final String RDF_URI
RSS_NSback to summary
private static final Namespace RSS_NS
RSS_URIback to summary
private static final String RSS_URI

Constructor Detail

RSS090Parserback to summary
public RSS090Parser()
RSS090Parserback to summary
protected RSS090Parser(final String type, final Namespace ns)

Method Detail

getContentNamespaceback to summary
protected Namespace getContentNamespace()

Returns the namespace used by Content Module elements in document.

This implementation returns the EMTPY namespace.

Returns:Namespace

returns the EMPTY namespace.

getImageback to summary
protected Element getImage(final Element rssRoot)

This method exists because RSS0.90 and RSS1.0 have the 'image' element under the root elemment. And RSS0.91, RSS0.02, RSS0.93, RSS0.94 and RSS2.0 have it under the 'channel' element.

getItemsback to summary
protected List<Element> getItems(final Element rssRoot)

This method exists because RSS0.90 and RSS1.0 have the 'item' elements under the root elemment. And RSS0.91, RSS0.02, RSS0.93, RSS0.94 and RSS2.0 have the item elements under the 'channel' element.

getRDFNamespaceback to summary
protected Namespace getRDFNamespace()

Returns the namespace used by RDF elements in document of the RSS version the parser supports.

This implementation returns the EMTPY namespace.

Returns:Namespace

returns the EMPTY namespace.

getRSSNamespaceback to summary
protected Namespace getRSSNamespace()

Returns the namespace used by RSS elements in document of the RSS version the parser supports.

This implementation returns the EMTPY namespace.

Returns:Namespace

returns the EMPTY namespace.

getTextInputback to summary
protected Element getTextInput(final Element rssRoot)

This method exists because RSS0.90 and RSS1.0 have the 'textinput' element under the root elemment. And RSS0.91, RSS0.02, RSS0.93, RSS0.94 and RSS2.0 have it under the 'channel' element.

isMyTypeback to summary
public boolean isMyType(final Document document)

Implements com.rometools.rome.io.WireFeedParser.isMyType.

Doc from com.rometools.rome.io.WireFeedParser.isMyType.

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:Document

XML Document (JDOM) to check if it can be parsed by this parser.

Returns:boolean

true if the parser know how to parser this feed, false otherwise.

Annotations
@Override
parseback to summary
public WireFeed parse(final Document document, final boolean validate, final Locale locale) throws IllegalArgumentException, FeedException

Implements com.rometools.rome.io.WireFeedParser.parse.

Doc from com.rometools.rome.io.WireFeedParser.parse.

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

Parameters
document:Document

XML document (JDOM) to parse.

validate:boolean

indicates if the feed should be strictly validated (NOT YET IMPLEMENTED).

Returns:WireFeed

the resulting feed bean.

Annotations
@Override
Exceptions
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).
parseChannelback to summary
protected WireFeed parseChannel(final Element rssRoot, final Locale locale)

Parses the root element of an RSS document into a Channel bean.

It reads title, link and description and delegates to parseImage, parseItems and parseTextInput. This delegation always passes the root element of the RSS document as different RSS version may have this information in different parts of the XML tree (no assumptions made thanks to the specs variaty)

Parameters
rssRoot:Element

the root element of the RSS document to parse.

Returns:WireFeed

the parsed Channel bean.

parseImageback to summary
protected Image parseImage(final Element rssRoot)

Parses the root element of an RSS document looking for image information.

It reads title and url out of the 'image' element.

Parameters
rssRoot:Element

the root element of the RSS document to parse for image information.

Returns:Image

the parsed image bean.

parseItemback to summary
protected Item parseItem(final Element rssRoot, final Element eItem, final Locale locale)

Parses an item element of an RSS document looking for item information.

It reads title and link out of the 'item' element.

Parameters
rssRoot:Element

the root element of the RSS document in case it's needed for context.

eItem:Element

the item element to parse.

Returns:Item

the parsed RSSItem bean.

parseItemsback to summary
protected List<Item> parseItems(final Element rssRoot, final Locale locale)

Parses the root element of an RSS document looking for all items information.

It iterates through the item elements list, obtained from the getItems() method, and invoke parseItem() for each item element. The resulting RSSItem of each item element is stored in a list.

Parameters
rssRoot:Element

the root element of the RSS document to parse for all items information.

Returns:List<Item>

a list with all the parsed RSSItem beans.

parseTextInputback to summary
protected TextInput parseTextInput(final Element rssRoot)

Parses the root element of an RSS document looking for text-input information.

It reads title, description, name and link out of the 'textinput' or 'textInput' element.

Parameters
rssRoot:Element

the root element of the RSS document to parse for text-input information.

Returns:TextInput

the parsed RSSTextInput bean.

validateFeedback to summary
protected void validateFeed(final Document document) throws FeedException