Package com.oorian.rss
Class RssChannel
java.lang.Object
com.oorian.rss.RssChannel
Represents an RSS
<channel> element containing feed metadata and items.
The channel is the top-level container in an RSS 2.0 feed. It requires a title, link, and description. All other elements are optional.
Supports the atom:link extension for declaring a self-referencing feed URL,
which is recommended for feed validation.
Usage:
RssChannel channel = new RssChannel("My Blog", "https://example.com", "Latest posts");
channel.setLanguage("en-us")
.setAtomSelfLink("https://example.com/feed")
.addItem(new RssItem("Post Title", "https://example.com/post-1", "Summary"));
- Since:
- 0.1.0
- Author:
- Marvin P. Warble Jr.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionRssChannel(String title, String link, String description) Creates a channel with the required title, link, and description. -
Method Summary
Modifier and TypeMethodDescriptionaddCategory(String value) Adds a category to this channel.addCategory(String value, String domain) Adds a category with a domain to this channel.Adds an item to this channel.static StringformatRfc822Date(Date date) Formats aDateas an RFC 822 date string suitable for RSS date elements.getDocs()getImage()getItems()getLink()getTitle()intgetTtl()setAtomSelfLink(String atomSelfLink) Sets the self-referencing Atom link for this feed.setCopyright(String copyright) Sets the copyright notice for the content of this channel.Sets the URL that points to the documentation for the RSS format used.setGenerator(String generator) Sets the program used to generate the channel.Sets the channel image (logo).setLanguage(String language) Sets the language the channel is written in (e.g., "en-us").setLastBuildDate(Date lastBuildDate) Sets the last time the content of the channel changed.setManagingEditor(String managingEditor) Sets the email address for the managing editor of the channel content.setPubDate(Date pubDate) Sets the publication date for the content in this channel.setTtl(int ttl) Sets the time to live (TTL) in minutes, indicating how long a channel can be cached before refreshing from the source.setWebMaster(String webMaster) Sets the email address for the webmaster responsible for technical issues.com.oorian.xml.XmlElementConverts this channel to anXmlElement.
-
Constructor Details
-
RssChannel
Creates a channel with the required title, link, and description.- Parameters:
title- The name of the channel.link- The URL to the HTML website corresponding to this channel.description- A phrase or sentence describing the channel.
-
-
Method Details
-
setLanguage
Sets the language the channel is written in (e.g., "en-us").- Parameters:
language- The language code.- Returns:
- This channel for method chaining.
-
setCopyright
Sets the copyright notice for the content of this channel.- Parameters:
copyright- The copyright notice text.- Returns:
- This channel for method chaining.
-
setManagingEditor
Sets the email address for the managing editor of the channel content.- Parameters:
managingEditor- The editor email address.- Returns:
- This channel for method chaining.
-
setWebMaster
Sets the email address for the webmaster responsible for technical issues.- Parameters:
webMaster- The webmaster email address.- Returns:
- This channel for method chaining.
-
setPubDate
Sets the publication date for the content in this channel.- Parameters:
pubDate- The publication date.- Returns:
- This channel for method chaining.
-
setLastBuildDate
Sets the last time the content of the channel changed.- Parameters:
lastBuildDate- The date of the last content change.- Returns:
- This channel for method chaining.
-
setGenerator
Sets the program used to generate the channel. Defaults to "Oorian Framework".- Parameters:
generator- The generator string, ornullto omit the element.- Returns:
- This channel for method chaining.
-
setDocs
Sets the URL that points to the documentation for the RSS format used.- Parameters:
docs- The documentation URL.- Returns:
- This channel for method chaining.
-
setTtl
Sets the time to live (TTL) in minutes, indicating how long a channel can be cached before refreshing from the source.- Parameters:
ttl- The number of minutes to cache.- Returns:
- This channel for method chaining.
-
setImage
Sets the channel image (logo).- Parameters:
image- The channel image.- Returns:
- This channel for method chaining.
-
setAtomSelfLink
Sets the self-referencing Atom link for this feed. This is recommended for feed validation and discovery.When set, an
<atom:link>element will be added to the channel, and the Atom namespace will be declared on the RSS root element.- Parameters:
atomSelfLink- The full URL of this feed.- Returns:
- This channel for method chaining.
-
addItem
Adds an item to this channel.- Parameters:
item- The item to add.- Returns:
- This channel for method chaining.
-
addCategory
Adds a category to this channel.- Parameters:
value- The category text value.- Returns:
- This channel for method chaining.
-
addCategory
Adds a category with a domain to this channel.- Parameters:
value- The category text value.domain- The domain URI identifying the categorization taxonomy.- Returns:
- This channel for method chaining.
-
getTitle
-
getLink
-
getDescription
-
getLanguage
-
getCopyright
-
getManagingEditor
-
getWebMaster
-
getPubDate
-
getLastBuildDate
-
getGenerator
-
getDocs
-
getTtl
public int getTtl() -
getImage
-
getCategories
-
getItems
-
getAtomSelfLink
-
formatRfc822Date
Formats aDateas an RFC 822 date string suitable for RSS date elements.- Parameters:
date- The date to format.- Returns:
- The RFC 822 formatted date string (e.g., "Mon, 16 Feb 2026 12:00:00 +0000").
-
toXmlElement
public com.oorian.xml.XmlElement toXmlElement()Converts this channel to anXmlElement.- Returns:
- An XmlElement representing this
<channel>element with all sub-elements.
-