com.sun.syndication.io.impl
Class RSS090Parser

java.lang.Object
  extended by com.sun.syndication.io.impl.BaseWireFeedParser
      extended by com.sun.syndication.io.impl.RSS090Parser
All Implemented Interfaces:
WireFeedParser
Direct Known Subclasses:
RSS091UserlandParser, RSS10Parser

public class RSS090Parser
extends BaseWireFeedParser


Constructor Summary
  RSS090Parser()
           
protected RSS090Parser(String type, org.jdom.Namespace ns)
           
 
Method Summary
protected  org.jdom.Namespace getContentNamespace()
          Returns the namespace used by Content Module elements in document.
protected  org.jdom.Element getImage(org.jdom.Element rssRoot)
          This method exists because RSS0.90 and RSS1.0 have the 'image' element under the root elemment.
protected  List getItems(org.jdom.Element rssRoot)
          This method exists because RSS0.90 and RSS1.0 have the 'item' elements under the root elemment.
protected  org.jdom.Namespace getRDFNamespace()
          Returns the namespace used by RDF elements in document of the RSS version the parser supports.
protected  org.jdom.Namespace getRSSNamespace()
          Returns the namespace used by RSS elements in document of the RSS version the parser supports.
protected  org.jdom.Element getTextInput(org.jdom.Element rssRoot)
          This method exists because RSS0.90 and RSS1.0 have the 'textinput' element under the root elemment.
 boolean isMyType(org.jdom.Document document)
          Inspects an XML Document (JDOM) to check if it can parse it.
 WireFeed parse(org.jdom.Document document, boolean validate)
          Parses an XML document (JDOM Document) into a feed bean.
protected  WireFeed parseChannel(org.jdom.Element rssRoot)
          Parses the root element of an RSS document into a Channel bean.
protected  Image parseImage(org.jdom.Element rssRoot)
          Parses the root element of an RSS document looking for image information.
protected  Item parseItem(org.jdom.Element rssRoot, org.jdom.Element eItem)
          Parses an item element of an RSS document looking for item information.
protected  List parseItems(org.jdom.Element rssRoot)
          Parses the root element of an RSS document looking for all items information.
protected  TextInput parseTextInput(org.jdom.Element rssRoot)
          Parses the root element of an RSS document looking for text-input information.
protected  void validateFeed(org.jdom.Document document)
           
 
Methods inherited from class com.sun.syndication.io.impl.BaseWireFeedParser
extractForeignMarkup, getAttribute, getAttributeValue, getType, parseFeedModules, parseItemModules, parsePersonModules
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RSS090Parser

public RSS090Parser()

RSS090Parser

protected RSS090Parser(String type,
                       org.jdom.Namespace ns)
Method Detail

isMyType

public boolean isMyType(org.jdom.Document document)
Description copied from interface: WireFeedParser
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 WireFeed parse(org.jdom.Document document,
                      boolean validate)
               throws IllegalArgumentException,
                      FeedException
Description copied from interface: WireFeedParser
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:
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).

validateFeed

protected void validateFeed(org.jdom.Document document)
                     throws FeedException
Throws:
FeedException

getRSSNamespace

protected org.jdom.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:
returns the EMPTY namespace.

getRDFNamespace

protected org.jdom.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:
returns the EMPTY namespace.

getContentNamespace

protected org.jdom.Namespace getContentNamespace()
Returns the namespace used by Content Module elements in document.

This implementation returns the EMTPY namespace.

Returns:
returns the EMPTY namespace.

parseChannel

protected WireFeed parseChannel(org.jdom.Element rssRoot)
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 - the root element of the RSS document to parse.
Returns:
the parsed Channel bean.

getItems

protected List getItems(org.jdom.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.


getImage

protected org.jdom.Element getImage(org.jdom.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.


getTextInput

protected org.jdom.Element getTextInput(org.jdom.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.


parseImage

protected Image parseImage(org.jdom.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 - the root element of the RSS document to parse for image information.
Returns:
the parsed image bean.

parseItems

protected List parseItems(org.jdom.Element rssRoot)
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 - the root element of the RSS document to parse for all items information.
Returns:
a list with all the parsed RSSItem beans.

parseItem

protected Item parseItem(org.jdom.Element rssRoot,
                         org.jdom.Element eItem)
Parses an item element of an RSS document looking for item information.

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

Parameters:
rssRoot - the root element of the RSS document in case it's needed for context.
eItem - the item element to parse.
Returns:
the parsed RSSItem bean.

parseTextInput

protected TextInput parseTextInput(org.jdom.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 - the root element of the RSS document to parse for text-input information.
Returns:
the parsed RSSTextInput bean.


Copyright © 2004-2013 ROME Project. All Rights Reserved.