CFUGitives User Group
Apr 18,
I just got back from the CFUGitives user group; and had a few ramblings that I thought I'd share with the world.
First off, I spoke a bit about Flex and demonstrated some of the proof-of-principle demos I'd been working on. Nothing mind-blowing; but it's good to be moving forward w/ the technology.
Second; in earlier meetings they discussed creating a group application. Well, it looks like this is actually going to get off the ground. The 'leader' on the project signed up the project on cfopen.org. Since a lot of the group has high interest in Flex stuff, the decision is to try to implement things as an API; so that any front end can be built on top of it (And theoretically so that future features could be easily tacked on ). I offered to do some object modeling for it. I believe I'll be walking a fine line between Simplicity and Flexibility. Kudos to Erik for getting it started.
Third, we spoke a bit about Woot.com's RSS feed. Some of the items have colons in them, such as "media:thumbnail". How do you access them by name; as opposed to hard-coded array positions. We didn't walk away with a specific solution, but I stepped through the problem when I came home. This was my approach.
First, we need to get the feed:
2<cfset results = xmlparse(cfhttp.filecontent)>
When traversing feeds like this, I often like to dump them to make it easier to see visually:
I see the top level channel is 'rss', so let me dump that:
After, RSS is Channel (it's only child)
Now, we're going after media:thumbnail. We can skip the iTunes stuff and go right to the items. I'm not quite sure how to sort out product listings blog entries in the woot RSS (I believe the coder was doing that), so for this example i'm assuming that we're getting item 2, the first woot product (at the time of this writing)
From there, I got the media:thumbnail. The ':' is invalid in a variable name, so you can't access it using the structure dot notation we've been using. I used the associative array notation:
From there, we can get the thumbnail location:
When dealing with foreign RSS feeds, I often use this type of drill down approach to get at the data I want / need.
#1 by robert francis on 3/6/07 - 6:05 PM
#2 by Jeffry Houser on 3/6/07 - 6:17 PM