Follow up on creating ATOM Feeds with RSS

This post is more than 2 years old.

A few months ago I posted a quick blog entry on metadata properties for creating Atom feeds in ColdFusion. This is not well documented in the ColdFusion docs, so I had to spend time reading the spec to get what I needed to pass to ColdFusion.

I exchanged a few emails with Chris and wanted to share some of what we found.

The first issue he had was with links for his Atom feed. He tried using a columnMap value of atomLink:

<cfset columnmap = structNew() /> <cfset columnmap.title = "title" /> <cfset columnmap.atomlink = "pub_url" /> <cfset columnmap.publisheddate = "date_published_utc" /> <cfset columnmap.content = "description" />

This failed with:

There is a problem in the column mappings specified in the columnMap structure. The cffeed query does not contain any column by the name of ATOMLINK.

This is a bad error. His query certainly did contain the column. However, AtomLink isn't valid for Atom feeds. If you read the docs for CFFEED, you will see there is a large table that describes what columns map to both RSS and Atom feeds. From here I found that the column he wants is linkhref.

<cfset columnmap = structNew() /> <cfset columnmap.title = "title" /> <cfset columnmap.linkhref = "link"/> <cfset columnmap.publisheddate = "posted" />

The next problem was weirder. He used the content property to point to his query:

<cfset columnmap.content = "body" />

This worked, but anytime the body column had a comma in it, the data would only render to the comma. So if content was: "Camden, Raymond", then you would see "Camden" in the XML. Checking the Atom reference for content, all I saw mentioned was that the content type could be text, html, or xhtml. I added a new column to my query called content type, and supplied it first with the value text. This didn't work. I then tried html and xhtml and those didn't work as well. The only thing the Atom spec mentioned (unless I read too quick) was that HTML needed to be escaped, but even simple strings refused to work.

Chris found another solution though. If you use the summary column than it works just fine. From what I read of the spec, summary is probably a better fit for RSS feeds anyway.

I hope this helps. Frankly I almost feel like Atom feeds are too much trouble. They are more powerful then RSS2 in that they can be more descriptive, but shoot, it seems like a real hassle to actually use them.

Raymond Camden's Picture

About Raymond Camden

Raymond is a senior developer evangelist for Adobe. He focuses on document services, JavaScript, and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can even buy me a coffee!

Lafayette, LA

Archived Comments

Comment 1 by Emmet posted on 6/20/2009 at 2:10 AM

Nice post Ray. I haven't had a need for cffeed until recently. Its been one roadblock after another. This clears up the comma issue I was having.

Comment 2 by Gurpreet posted on 7/3/2010 at 4:14 PM

Hi Ray! working with the Feeds! While iuse this thing:

<cfset cmap.content = "StoryFullDesc">

after the very first Comma, it truncates the whole string and does not show up! anyworkaround this thing

Comment 3 by Raymond Camden posted on 7/3/2010 at 4:58 PM

Did you read the last paragraph? :) It talks about this specificially.

Comment 4 by Gurpreet posted on 7/3/2010 at 6:59 PM

i read it but did not understood properly so i asked here!
it means it is a BUG

Comment 5 by Gurpreet posted on 7/3/2010 at 7:01 PM

Ah!! I used summary instead of content and it worked! Hmm! definately a stupid issue in Coldfusion

Comment 6 by Raymond Camden posted on 7/3/2010 at 7:03 PM

I'm still not quite convinced it is a cffeed bug. I think it may be some part of the ATOM spec I don't quite get.