Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > Issue with reading from an Atom Feed View modes: 
User avatar
Member
Member
thomasdb - 10/19/2011 5:25:08 AM
   
Issue with reading from an Atom Feed
I have been trying to display an atom feed within Kentico site through various methods, with little success and hoped someone might be able to help.

My initial approach was to use the RSS Reader webpart that can be downloaded via the Market Place but as it did not work I moved to an more standard approach - using an XML Datasource webpart paired with a Basic Repeater webpart. However this too gave me incorrect output.

The issue appears to be in the reading of all or part of the atom feed. I configured the XML Datasource to point at an example atom feed - http://blogs.adobe.com/feed/atom for example - and set the table value to "entry" which is the main repeating tag for the data within atom. The basic repeater is connected to this datasource and using a basic customer transformation is should display some simple data:

<div class="atomItem">
<div class="atomTitle">
<a href='<%# Eval("link") %>'><%# Eval("title") %></a>
</div>
<div class="atomDescription">
<%# Eval("summary") %>
</div>
<div class="atomPubDate">
<%# Eval("updated") %>
</div>
</div>
<br />

However it only displays the updated value for each entry and none of the other information, that while it is present in the feed - does not seem to be loaded into the datasource so that it can be queried.

This is just an example of the atom feed issue - the real feed that I wish to embedded displays even less when selected as a source for the xml datasource and I need to understand what is happening so that I can correct it.

I am unable to modify the atom feed itself, i just need a reliable method for displaying its contents within a Kentico page.

Any assistance will be greatly appreciated.

User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 10/24/2011 3:31:08 AM
   
RE:Issue with reading from an Atom Feed
Hi,

the issue may be in the used transformation. Here is an example of transformation which can be used with a xml data source in atom feed web part:

<entry>
<title><![CDATA[<%# Eval("NewsTitle") %>]]></title>
<link href="<%# GetAbsoluteUrl(GetDocumentUrlForFeed(), Eval("SiteName")) %>"/>
<id>urn:uuid:<%# Eval("NodeGUID") %></id>
<published><%# GetAtomDateTime(Eval("NewsReleaseDate")) %></published>
<updated><%# GetAtomDateTime(Eval("DocumentModifiedWhen")) %></updated>
<author>
<name><%# Eval("NodeOwnerFullName") %></name>
</author>
<summary type="html"><![CDATA[<%# Eval("NewsSummary") %>]]></summary>
</entry>


In the XML data source has to be filled following properties:

XML URL (e.g. http://devnet.kentico.com/CMSPages/BugtrackerRss.aspx)
Table name: item

If it will not help, could you please share with us the url, from which data should be read.

Best regards,
Ivana Tomanickova

User avatar
Member
Member
thomasdb - 10/24/2011 4:18:29 AM
   
RE:Issue with reading from an Atom Feed
Ok so here is the URL of the atom feed I am attempting to display:
http://hosted2.ap.org/atom/ILDLB/8ef5320729ce4298abefc1903704c7d5

It is a Associated Press News Story feed.

I have the XML data source connecting to it using the properties:
URL: http://hosted2.ap.org/atom/ILDLB/8ef5320729ce4298abefc1903704c7d5
Table name: entry

The basic repeater which connects to it is simply configured to connect to that xml datasource and use the transformation I included in my previous post to render the results.

But as you can see (hopefully) when configured this does not actually work.

Because the feed is generated outside of Kentico I have no control over its contents, I just need to be able to extract the fields I need and display them within my Kentico site (using the transformation)

Is of any further help?

User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 11/1/2011 7:19:19 AM
   
RE:Issue with reading from an Atom Feed
Hi,

I am sorry for delay. We were quite busy last week.

As for your atom feed. I tested it in a debug mode and method dataSet.ReadXMLwhich is called by the web part throws following error with your feed:
'Cannot add constraint to DataTable 'a' which is a child table in two nested relations.'

I searched for this error and a suggestion was to write XSD definition of the xml file.

Alternatively, you can try to rewrite the feed - its current version is not valid. Please test it here:
http://feedvalidator.org/

Best regards,
Ivana Tomanickova