org.apache.commons.digester.rss
Class RSSDigester

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by org.apache.commons.digester.Digester
          extended by org.apache.commons.digester.rss.RSSDigester
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

public class RSSDigester
extends org.apache.commons.digester.Digester

Implementation of org.apache.commons.digester.Digester designed to process input streams that conform to the Rich Site Summary DTD, version 0.91. For more information about this format, see the My Netscape site.

The default implementation object returned by calling parse() (an instance of org.apache.commons.digester.rss.Channel) knows how to render itself in XML format via the render() method. See the test main() method below for an example of using these classes.


Field Summary
protected  java.lang.String channelClass
          The fully qualified class name of the Channel implementation class.
protected  boolean configured
          Have we been configured yet?
protected  java.lang.String imageClass
          The fully qualified class name of the Image implementation class.
protected  java.lang.String itemClass
          The fully qualified class name of the Item implementation class.
protected static java.lang.String[] registrations
          The set of public identifiers, and corresponding resource names, for the versions of the DTDs that we know about.
protected  java.lang.String textInputClass
          The fully qualified class name of the TextInput implementation class.
 
Fields inherited from class org.apache.commons.digester.Digester
bodyText, bodyTexts, classLoader, entityResolver, entityValidator, errorHandler, factory, JAXP_SCHEMA_LANGUAGE, locator, log, match, matches, namespaceAware, namespaces, params, parser, publicId, reader, root, rules, saxLog, schemaLanguage, schemaLocation, stack, substitutor, useContextClassLoader, validating, W3C_XML_SCHEMA
 
Constructor Summary
RSSDigester()
           
 
Method Summary
protected  void configure()
          Configure the parsing rules that will be used to process RSS input.
 java.lang.String getChannelClass()
           
 java.lang.String getImageClass()
           
 java.lang.String getItemClass()
           
 java.lang.String getTextInputClass()
           
static void main(java.lang.String[] args)
          Test main program that parses the channel description included in this package as a static resource.
 java.lang.Object parse(java.io.File file)
          Parse the content of the specified file using this Digester.
 java.lang.Object parse(org.xml.sax.InputSource input)
          Parse the content of the specified input source using this Digester.
 java.lang.Object parse(java.io.InputStream input)
          Parse the content of the specified input stream using this Digester.
 java.lang.Object parse(java.lang.String uri)
          Parse the content of the specified URI using this Digester.
 void setChannelClass(java.lang.String channelClass)
           
 void setImageClass(java.lang.String imageClass)
           
 void setItemClass(java.lang.String itemClass)
           
 void setTextInputClass(java.lang.String textInputClass)
           
 
Methods inherited from class org.apache.commons.digester.Digester
addBeanPropertySetter, addBeanPropertySetter, addCallMethod, addCallMethod, addCallMethod, addCallMethod, addCallParam, addCallParam, addCallParam, addCallParam, addCallParamPath, addFactoryCreate, addFactoryCreate, addFactoryCreate, addFactoryCreate, addFactoryCreate, addFactoryCreate, addFactoryCreate, addFactoryCreate, addFactoryCreate, addFactoryCreate, addObjectCreate, addObjectCreate, addObjectCreate, addObjectCreate, addObjectParam, addRule, addRuleSet, addSetNestedProperties, addSetNestedProperties, addSetNestedProperties, addSetNext, addSetNext, addSetProperties, addSetProperties, addSetProperties, addSetProperty, addSetRoot, addSetRoot, addSetTop, addSetTop, characters, clear, createSAXException, createSAXException, createSAXException, endDocument, endElement, endPrefixMapping, error, fatalError, findNamespaceURI, getClassLoader, getCount, getCurrentElementName, getCustomContentHandler, getDebug, getDocumentLocator, getEntityResolver, getErrorHandler, getFactory, getFeature, getLogger, getMatch, getNamespaceAware, getParser, getProperty, getPublicId, getReader, getRoot, getRuleNamespaceURI, getRules, getSAXLogger, getSchema, getSchemaLanguage, getSubstitutor, getUseContextClassLoader, getValidating, getXMLReader, ignorableWhitespace, initialize, isEmpty, log, log, notationDecl, parse, peek, peek, peek, peek, peekParams, peekParams, pop, pop, popParams, processingInstruction, push, push, pushParams, register, resetRoot, resolveEntity, setClassLoader, setCustomContentHandler, setDebug, setDocumentLocator, setEntityResolver, setErrorHandler, setFeature, setLogger, setNamespaceAware, setProperty, setPublicId, setRuleNamespaceURI, setRules, setSAXLogger, setSchema, setSchemaLanguage, setSubstitutor, setUseContextClassLoader, setValidating, skippedEntity, startDocument, startElement, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

configured

protected boolean configured
Have we been configured yet?


registrations

protected static final java.lang.String[] registrations
The set of public identifiers, and corresponding resource names, for the versions of the DTDs that we know about.


channelClass

protected java.lang.String channelClass
The fully qualified class name of the Channel implementation class.


imageClass

protected java.lang.String imageClass
The fully qualified class name of the Image implementation class.


itemClass

protected java.lang.String itemClass
The fully qualified class name of the Item implementation class.


textInputClass

protected java.lang.String textInputClass
The fully qualified class name of the TextInput implementation class.

Constructor Detail

RSSDigester

public RSSDigester()
Method Detail

getChannelClass

public java.lang.String getChannelClass()

setChannelClass

public void setChannelClass(java.lang.String channelClass)

getImageClass

public java.lang.String getImageClass()

setImageClass

public void setImageClass(java.lang.String imageClass)

getItemClass

public java.lang.String getItemClass()

setItemClass

public void setItemClass(java.lang.String itemClass)

getTextInputClass

public java.lang.String getTextInputClass()

setTextInputClass

public void setTextInputClass(java.lang.String textInputClass)

parse

public java.lang.Object parse(java.io.File file)
                       throws java.io.IOException,
                              org.xml.sax.SAXException
Parse the content of the specified file using this Digester. Returns the root element from the object stack (which will be the Channel).

Overrides:
parse in class org.apache.commons.digester.Digester
Parameters:
file - File containing the XML data to be parsed
Throws:
java.io.IOException - if an input/output error occurs
org.xml.sax.SAXException - if a parsing exception occurs

parse

public java.lang.Object parse(org.xml.sax.InputSource input)
                       throws java.io.IOException,
                              org.xml.sax.SAXException
Parse the content of the specified input source using this Digester. Returns the root element from the object stack (which will be the Channel).

Overrides:
parse in class org.apache.commons.digester.Digester
Parameters:
input - Input source containing the XML data to be parsed
Throws:
java.io.IOException - if an input/output error occurs
org.xml.sax.SAXException - if a parsing exception occurs

parse

public java.lang.Object parse(java.io.InputStream input)
                       throws java.io.IOException,
                              org.xml.sax.SAXException
Parse the content of the specified input stream using this Digester. Returns the root element from the object stack (which will be the Channel).

Overrides:
parse in class org.apache.commons.digester.Digester
Parameters:
input - Input stream containing the XML data to be parsed
Throws:
java.io.IOException - if an input/output error occurs
org.xml.sax.SAXException - if a parsing exception occurs

parse

public java.lang.Object parse(java.lang.String uri)
                       throws java.io.IOException,
                              org.xml.sax.SAXException
Parse the content of the specified URI using this Digester. Returns the root element from the object stack (which will be the Channel).

Overrides:
parse in class org.apache.commons.digester.Digester
Parameters:
uri - URI containing the XML data to be parsed
Throws:
java.io.IOException - if an input/output error occurs
org.xml.sax.SAXException - if a parsing exception occurs

configure

protected void configure()
Configure the parsing rules that will be used to process RSS input.

Overrides:
configure in class org.apache.commons.digester.Digester

main

public static void main(java.lang.String[] args)
Test main program that parses the channel description included in this package as a static resource.

Parameters:
args - The command line arguments (ignored)


Copyright 2002-2008 The Apache Software Foundation. All Rights Reserved.