[thelist] CFMX and RSS
Chris Hayes
chris at lwcdial.net
Wed Jun 29 11:52:26 CDT 2005
To be honest I never found XPath very efficient and if speed is an issue I
just do some Good Ol' Days text looping-juggling with the results and
populate my own query / struct. This, fortunately, is a breeze in CF.
----- Original Message -----
From: "Russ" <russ at unrealisticexpectations.com>
To: <thelist at lists.evolt.org>
Sent: Wednesday, June 29, 2005 12:09 AM
Subject: [thelist] CFMX and RSS
> I'm having a minor bit of a nightmare--something that's driving me nuts,
> actually.
>
> I'm using the following code within CFMX to bring down an RSS feed:
>
>
> <!--- download the xml document using http --->
> <cfhttp method="GET" url="http://www.website.com/wpost.xml">
>
> <!--- parse the XML text into a CF variable --->
> <cfset newsfeed=XMLParse(Trim(cfhttp.filecontent))>
>
> <!--- uncomment next line to see XML content --->
> <!--- <cfdump var="#newsfeed#"> --->
>
> <!--- use XPath to search for headlines and links
> XMLSearch returns an array of found records --->
> <!--- this will find all "items" with a "title" tag underneath within
> <rss> and <channel> tags --->
> <cfset category=XMLSearch(newsfeed,'/rss/channel/category')>
>
> <!--- similar to above, this will find the URL referenced by each
> story --->
>
> <cfset title=XMLSearch(newsfeed,'/rss/channel/item/title')>
> <cfset links=XMLSearch(newsfeed,'/rss/channel/item/link')>
> <cfset description=XMLSearch(newsfeed,'/rss/channel/item/description')>
> <!--- This is all the XML Stuff to Bring Down The Feed --->
>
> Seems to work at home just fine on my WinServer2003. No issues
> whatsoever. When I upload it to my Fedora box, however, it's chugging
> and puking on my like crazy. It's nasty.
>
> It doesn't seem like it should be, so I'm wondering if anyone has a
> different solution that they're using or if anyone can help me out?
>
> An alternate solution I've used is to set a cron job to run and get the
> XML file and save it locally so as to not run to the server all the
> time. This hasn't really helped much, but it was worth a shot.
>
> The display code is pretty simple, in case it helps:
>
> <cfoutput>
> <cfloop from="1" to="5" index="n">
>
> <tr>
> <td class="navBottomStroke"><a href="#links[n].xmltext#"
> class="navigation"
> target="_new">#title[n].xmltext#</a><br>#description[n].xmltext#
>
> </td>
> </tr>
> </cfloop>
>
> </cfoutput>
>
> Thanks in advance for any help.
>
> Russ
>
>
> --
>
> * * Please support the community that supports you. * *
> http://evolt.org/help_support_evolt/
>
> For unsubscribe and other options, including the Tip Harvester
> and archives of thelist go to: http://lists.evolt.org
> Workers of the Web, evolt !
More information about the thelist
mailing list