OpenWGA 7.3 - OpenWGA Concepts and Features
Data sourcesRSS Feed Connector
The RSS Feed Connector lets the result of RSS/ATOM feeds be retrieved and processed in WebTML.
It builds upon the Java Library Informa, which is capable of parsing feeds in the formats RSS 0.9x, RSS 1.0 / RDF, RSS 2.0, Atom 0.3 and Atom 1.0.
Connecting
The RSS Feed Connector is a data source which can be found on the virtual database server "Other sources" which is built-in on every OpenWGA runtime without registration.
As a single RSS Feed Connector data source is not bound to any feed but can be used to query all feeds it does not need any more configuration. You optionally however may need to configure the database option "HTTP Proxy Server" to let the connector fetch the feeds via a proxy.
Using in WebTML
Fetching a Feed on the RSS Feed Connector is done by querying it via <tml:query>, using the feed URL as query term, and then iterating over the results via <tml:foreach>. The feed postings will be served as virtual content documents that expose the posting data as items and metadata. The following example assumes an RSS Feed Connector connected unter database key "rss":
<tml:collection>
<tml:query db="rss">http://www.openwga.com/blog/xml/rss20/openwga.int.xml</tml:query>
<tml:foreach>
<h2><tml:link/> (by <tml:meta name="author"/> at <tml:meta name="lastmodified" format="dd.MM.yyyy HH:mm"/>)</h2>
<div>
<tml:meta name="description"/>
</div>
</tml:foreach>
</tml:collection>
If a RSS feed needs authentication for loading you can provide a login via native query options "user" and "pwd". The values of both options can be quoted in single quotes:
<tml:query db="rss" options="user:'me',pwd:'secret'">http://www.openwga.com/blog/xml/rss20/openwga.int.xml</tml:query>
Available WebTML content metadata fields are:
- TITLE: The title of the posting
- AUTHOR: The author of the posting
- DESCRIPTION: The abstract of the posting
- VIRTUALLINK/VIRTUALLINKTYPE: Interprets the posting as "virtual document" and provides the URL of the posting. So you can use <tml:url> or <tml:link> (or this.contentURL() in TMLScript) to create links to the posting
- CREATED/LASTMODIFIED: Returns the publication date of the posting
Additionally the following items can be retrieved:
- categories: The categories of the posting as collection
- comments: An URL to a comments page for the posting
- document: The XML root element object as Dom4J element (see XML support) that represents the complete feed document. Use attribute xpath on <tml:item> to retrieve individual data fields of the posting element.
- element: The XML element object as Dom4J element (see XML support) that represents the posting in the feed. Use attribute xpath on <tml:item> to retrieve individual data fields of the posting element.
- guid: The posts global universal ID
- guid_permalink: Boolean item being true if the GUID is marked as being a permalink
Note that the RSS feed connector does not cache results but instead retrieves the feed on each query. As it is discouraged to retrieve subscribed feeds each time they are displayed you should try to cache your results using WebTML Cache.