Fetching feeds

The Feed connector is able to fetch various types of feeds and convert the input markup to RSS 2.0. It is the page author's responsibility to provide an XSL transformation that extracts the relevant information and converts the output into an XDIME fragment.

The Feed connector is able to fetch various types of feeds and convert the input markup to RSS 2.0. It is the page author's responsibility to provide an XSL transformation that extracts the relevant information and converts the output into an XDIME fragment.

The connector can handle several types of feeds, namely:

Please note that if there is an HTML fragment in an item description, it will be available as a subtree of elements rather than a plain text node. In addition, for a given feed some of the optional RSS 2.0 elements may not be present in the output either because they are missing in the source feed or there is no mapping between input and output elements.

Markup

The feed:fetch element represents the connector. Its url attribute specifies the URI of a feed to retrieve. The element needs to be wrapped in a pipeline:transform element.

<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/2002/06/xhtml2"
  xmlns:mcs="http://www.volantis.com/xmlns/2006/01/xdime/mcs"
  xmlns:pipeline="http://www.volantis.com/xmlns/marlin-pipeline"
  xmlns:feed="http://www.volantis.com/xmlns/2010/11/feed">
  <head>
    <title>feed:fetch</title>
  </head>
  <body>
    <pipeline:try>
      <pipeline:preferred>
        <pipeline:transform href="rss2xdime.xsl">
          <feed:fetch url="http://feeds.nytimes.com/nyt/rss/HomePage"/>
        </pipeline:transform>
      </pipeline:preferred>
      <pipeline:alternative>
        <pipeline:content>
          <p>There was a problem retrieving the information requested.</p>
          <p>Message: <pipeline:value-of expr="pipeline:errorMessage()"/></p>
          <p>Source Id: <pipeline:value-of expr="pipeline:errorSourceID()"/></p>
          <p>Code Name: <pipeline:value-of expr="pipeline:errorCodeName()"/></p>
          <p>Code URI: <pipeline:value-of expr="pipeline:errorCodeURI()"/></p>
        </pipeline:content>
      </pipeline:alternative>
    </pipeline:try>
  </body>
</html>

An example of an XSL transformation that converts RSS 2.0 to XDIME 2 can be found in the ${MCS_HOME}/webapps/mcs.war/projects/connectors/feed/ directory.

Authentication

The connector supports HTTP basic authentication, i.e. if authentication is required, the username and password must be supplied in the URL.

http://<user>:<password>@<feed-url>

Handling errors

The connector supports the use of the pipeline error functions. These functions enable trapping and handling errors that occur during pipeline processing. The following table lists all the errors supported by the connector. The errors are in the http://www.volantis.com/xmlns/2010/11/feed namespace. Refer to the topics entitled Handling pipeline errors and Pipeline error functions for more information about the pipeline error functions.

Name Description
authentication-failure An error occurred while retrieving the feed due to missing or incorrect authentication information.
general-failure A generic error.
processing-failure An error occurred while processing the feed.
retrieval-failure An error occurred while retrieving the feed.
timeout-failure An error occurred while retrieving the feed due to the timeout.

Related topics