FileDocCategorySizeDatePackage
RSSChannelTag.javaAPI DocExample1607Sat Nov 22 19:55:24 GMT 2003vhexample.view

RSSChannelTag

public class RSSChannelTag extends BodyTagSupport
A custom tag for the RSS channel. Exposes two scripting variables for channel name and link. Also used by nested item tags to find the information for each item in the channel

Fields Summary
private static final String
NAME_ATTR
the names of the scripting variable
private static final String
LINK_ATTR
private String
url
the url of the RSS page
private RSSInfo
rssInfo
the RSS parser
Constructors Summary
public RSSChannelTag()
Constructor

    
           
      
        rssInfo = new RSSInfo();
    
Methods Summary
public intdoStartTag()
Parse the RSS and set the scripting variables

        try {
            // parse the rss
            rssInfo.parse(url);
            
            // export the scripting variables
            pageContext.setAttribute(NAME_ATTR, rssInfo.getChannelTitle());
            pageContext.setAttribute(LINK_ATTR, rssInfo.getChannelLink());
        } catch (Exception ex) {
            throw new JspException("Unable to parse " + url, ex);
        }
        
        return Tag.EVAL_BODY_INCLUDE;
    
protected RSSInfogetRSSInfo()
Called by nested tags to get the RSS parser

        return rssInfo;
    
public voidsetURL(java.lang.String url)
Called with the URL attribute of the tag

        this.url = url;