The component gb.web.feed - WebFeed for short - corresponds to the RSS 2.0 specification, which you can also read about at https://cyber.harvard.edu/rss/rss.html.
Areas of application for RSS are, for example, news sites, blogs or podcasts whose contents are updated regularly - often several times a day. In addition to the RSS document structure and the terminology of RSS, you should also know XML as the basis of structured data in order to be able to use the WebFeed component successfully.
An RSS file is an XML file consisting of several 'channels', which in turn consist of 'entries'. Each entry is a unit that summarises a `news item` or whatever the content of the feed is. The gb.web.feed component can both read and write RSS files and supports images, media attachments, text input elements and cloud tags.
Example of an excerpt from an RSS feed:
<?xml version="1.0" encoding="UTF-8" ?> <?xml-stylesheet href="/resources/xsl/rss2.jsp" type="text/xsl"?> <rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/"> <channel> ... <item> <title>Corona-Pandemie ...</title> <link>https://www.....html</link> <pubDate>Sun, 11 Oct 2020 10:14:50 +0200</pubDate> ... <description>Die gemeldeten Infektionszahlen bleiben hoch. ...</description> </item> ... </channel> </rss>
This class represents an RSS document. Its properties are those of its individual elements. It behaves like a read-write array of RssItem objects.
In the following example, the RSS feed data in XML format (→ Chapter 18.12.5 RSS reader) of a website is read out. Here is the abbreviated RSS XML source text excerpt for an entry:
<item> <title>DFB-Elf ...</title> <link>http://www.unsersport.de/fussball/nationalmannschaft/...html</link> <description>Die Nationalmannschaft gewinnt in Krusemark mit 12:0 gegen den SV Heidesand.</description> </item>
You can go through the individual RSS entries in the order in which they appear in the RSS document:
Dim hRss As Rss Dim hRssItem As RssItem For Each hRssItem In hRss ... Next
The following source code returns an RssItem at the `index` RSS document position:
Dim hRss As Rss Dim hRssItem As RssItem hRssItem = hRss [ Index As Integer ]
So you replace an existing item in the RSS document at the position `Index`:
Dim hRss As Rss Dim hRssItem As RssItem hRss [ Index As Integer ] = hRssItem
The Rss class has these properties:
Property | DataType | Description |
---|---|---|
Title | String | The name or title of the feed. |
Link | String | The URL to the website corresponding to this feed. |
Description | String | Provides a description of the content of the feed. |
Categories | RssCategory[] | Represents an array of categories for this feed. |
Cloud | RssCloud | Provides a description of an associated cloud service. |
Copyright | String | Copyright notice for the content of the feed. |
Count | Integer | Returns the number of RssItems in the RSS document. |
Docs | String | Returns a link to the RSS specification to inform about what an RSS file is, if the documentation exists. |
Generator | String | Names the program used to generate the feed. |
Image | RssImage | Returns an image associated with the feed. |
Language | String | The language in which the content of the feed is written. Use a value defined according to https://cyber.harvard.edu/rss/languages.html ! |
LastBuild | RssDate | The date and time zone of the last change of the feed content. If the property is not set, the default is the time when the XML document was written in the local time zone. |
ManagingEditor | String | Email address of the managing (feed) editor. |
Pub | RssDate | Publication date/time zone of the feed. For example, a newspaper with daily publication would change a feed at least once a day. If the default is not set, it defaults to the time the XML document was written in the local time zone. |
Rating | String | PICS rating of the feed - if it exists. |
SkipDays | Integer[ ] | A hint for news aggregators. It specifies a number of days of the week (gb.Monday, gb.Tuesday, etc.) when no new content is expected in the feed. A client can ignore this setting. However, it can also use it to save traffic. You can only specify up to 7 skip days. |
SkipHours | Integer[ ] | A hint for news aggregators. It specifies a number of hours in the range 0 to 23 in which no new content is expected in the feed. A client can ignore this setting, but can also use it to save traffic. You can only specify up to 24 skip hours. |
TextInput | RssTextInput | Describes a text input field to be displayed with the feed. |
TTL | Integer | 'Time To Live' specifies how long the content of the feed may be cached. The unit of TTL is minutes. |
WebMaster | String | Email address of the webmaster. |
Table 24.12.0.1 : Properties of the class Rss
The class Rss has these methods:
Method | ReturnType | Description |
---|---|---|
Sub Add ( Item As RssItem [ , Index As Integer ] ) | - | Adds an Rss item to the document. If the index is specified, the item is inserted at the specified position in the array of items. By default it is inserted at the end. |
Sub Clear ( ) | - | All properties of the Rss object are set to zero and the element array is emptied completely. |
Sub FromString ( argData As String ) | - | Reads the RSS document in XML format specified under 'argData' and fills the properties of this Rss object. |
Function ToString ( ) | String | Converts an Rss object into an XML document and returns its content. |
Sub Remove ( Index As Integer [ , Length As Integer ] ) | - | Removes as many Rss entries from the element array as specified by 'Length' - starting at the position 'Index'. By default, 'Length' is equal to 1. |
Sub Reverse ( ) | - | Reverses the order of the Rss entries in the element array. |
Sub Sort ( [ Mode As Integer ] ) | - | Sorts the Rss entries according to their date. You can select the mode as gb.Ascent or gb.Descent. The default is descending sort so that the newest items are first in the document. |
Table 24.12.0.2 : Methods of the class Rss
Properties of the class:
Property | Data type | Description |
---|---|---|
Category | String | The string describes the category. Use slashes as separators to structure categories hierarchically. |
Domain | String | The URL to the website corresponding to this feed. The category domain is an ID or URL to a category description. |
Table 24.12.0.3 : Properties of the RssCategory class.
The class has the following three integer constants:
RssCloud.XmlRpc (0)RssCloud.Soap (1)RssCloud.HttpPost (2).
These are the properties of the class:
Property | Data type | Description |
---|---|---|
Domain | String | Domain name of the application server. |
Path | String | The script path on the server. |
Protocol | Integer | `Protocol` represents the RSSCloud protocol to be used. Optionally XmlRpc, Soap or HttpPost. |
RegisterProcedure | String | Name of the registration procedure to be invoked on the server side. |
Table 24.12.0.4 : Properties of the RssCloud class.
You can create the class:
Dim hRssDate As RssDate hRssDate = New RssDate ( [ Date As Date, Zone As String ] )
This class has only two properties:
Property | Data type | Description |
---|---|---|
Date | Date is the date represented by this object. | |
Zone | String | Zone is the time zone - relative to which the date was inserted. Example: Sun, 11 Oct 2020 10:14:50 +0200 . |
Table 24.12.0.5 : Properties of the RssDate class
The class has these three properties:
Property | DataType | Description |
---|---|---|
Length | Long | The length of the attached file in bytes. |
Type | String | Returns or sets the MIME type of the file. |
Url | String | The URL of the attached file. |
Table 24.12.0.6 : Properties of the class RssEnclosure
GUID stands for 'Globally Unique IDentifier' - as a globally unique identifier for a particular feed item/article. The class has these properties:
Property | DataType | Description |
---|---|---|
Guid | String | GUID string. The value is a URL. |
IsPermaLink | Boolean | Returns whether this GUID is a permalink or sets a matching truth value. The default value of this property is True. |
Table 24.12.0.7 : Properties of the class RssGuid
The class RssImage has these properties:
Property | Data type | Description |
---|---|---|
Description | String | If the feed is rendered as HTML, this string shall become the title attribute of the link rendered around the image. |
Height | Integer | The height of the image. The maximum height is 400 pixels. The default value is 31 pixels. |
Width | Integer | The width of the image. The maximum width is 144 pixels. The default value is 88 pixels. |
Link | String | The URL of the website to which the feed belongs. If the feed is rendered as HTML, the RssImage becomes a link to this website. |
Title | String | An image title. It is to be used as the alt attribute of the HTML tag when the feed is rendered as HTML. |
Url | String | The URL of the image file. The specification requires that it be a GIF, JPEG or PNG file. |
Table 24.12.0.8 : Properties of the RssImage class.
These are the properties of the class RssItem:
Property | Data type | Description |
---|---|---|
Author | String | Author's email address. |
Categories | RssCategory[ ] | An array of categories for this entry. |
Comments | String | A URL pointing to a comments page for this entry. |
Description | String | A summary of the item. You can also use HTML. |
Enclosure | RssEnclosure | Describes a media attachment for this entry. |
Guid | RssGuid | A globally unique identifier for this article, for example a permalink to the full content of the article on your website. |
Link | String | A link to the website that contains the full content. |
Pub | RssDate | Publication date/time zone of the article. If this option is not set, the default is the time when the XML document was written in the local time zone. |
Source | RssSource | Use this property if an item comes from another RSS feed, so as to link to the original feed. |
Title | String | The title of the entry. |
Table 24.12.0.9 : Properties of the class RssItem
These are the two properties of the class RssSource:
Property | Data type | Description |
---|---|---|
Source | String | The feed title of the RSS feed of the specified source. |
Url | String | Link to the XML document of the external RSS feed. |
The class describes a text input field that can optionally be displayed with the feed to implement a comment function. The specification provides that RSS generators allow the creator of an RSS document to create text input fields and a corresponding CGI script on the domain. A reader of the RSS feed can thus - if his RSS feed client supports it - send a text directly from the display of the feed to the generator.
The class has these properties:
Property | Data type | Description |
---|---|---|
Description | String | Explanation of the purpose of the input field. |
Link | String | Link to the CGI script that processes the input. |
Name | String | Name of the input field, for use by the CGI script to which the input is sent. |
Title | String | The label of the submit button next to the input field. |
Table 24.12.0.11 : Properties of the class RssTextInput