-
25 Nov 2009 12:55 PM #1
Help with Rss Example Feed please
Help with Rss Example Feed please
Hi everyone, I started going through the example code 2 days ago and realized that it was using php or at least trying to on the backend. I am not familiar with php but have done coldfusion years ago. So, i figured i could just swap out the php files for cf files. I finally got the call to work and return an XML structure back to the caller. I am using firefox with the plugin and can see the response data contains the xml depending on how i modify my code so I know I do have the call returning the data but I cannot for the life of me get the xml to render to the feeder view. Can someone please help me? tell me what I must do.
-
25 Nov 2009 2:07 PM #2
My feed-proxy.cfm file
My feed-proxy.cfm file
Here is the code for the cf file I made based off of the php file.
Also, in the example file FeedWindow.js methodCode:<cffunction access="private" name="getRss" returntype="Struct" > <cfargument name="rssFeedUrl"> <cfhttp method="get" url="#rssFeedUrl#" result="rssFeedData"> <cfreturn rssFeedData> </cffunction> <cfscript> // this is an example server-side proxy to load feeds if(!IsDefined("feed")){ xml = 'Elijah no loading occured'; writeOutput(xml); } else{ if(feed != '' && FindNoCase(feed, 'http') == 0){ rssFeed = getRss(feed); xml = XmlParse(rssFeed.Filecontent); xml = ReplaceNoCase(xml, '<content:encoded>', '<content>'); xml = ReplaceNoCase(xml, '</content:encoded>', '</content>'); xml = ReplaceNoCase(xml, '</dc:creator>', '</author>'); xml = ReplaceNoCase(xml, '<dc:creator', '<author'); // This has value but the ajax xml response shows null writeOutput(xml); } // if } // if </cfscript>
validateFeed : function(response, options){...
The catch is always going off. Checking various steps in the method I have determined that
varxml = response.responseXML;
alert('xml' + xml); shows me that xml is always null.
Any insight on this please help. I'd rather not have to abandon yet another example code because it wont execute.
-
25 Nov 2009 3:33 PM #3
console.log(response);
inspect the response object using firebug, maybe that will help to point you in the right direction
-
25 Nov 2009 5:08 PM #4
Okay, when I was able to get the console command to run I saw that the value was under response response.responseText and not response.responseXML. However since your last post, I can not get console to display a damn thing. I can see the rss xml structure in the response tab but nothing displays in the viewer. So I am just assuming that the structure of how things are being done on the coldfusion side is not correct.
Does anyone know of any examples in coldfusion so that I can see what I need to do?
I could really use some more help here.
Thank you.
-
26 Nov 2009 9:50 AM #5
Code update for the Coldfusion side. Needed to set the cfcontent type.
So far I am able to specify in the add Rss Feed some feeds that will render, but some feeds do not register as valid with the Rss Feed example. Are all feeds supose to work in this or is there something else that I am missing?Code:<cfsetting showdebugoutput="no"> <!--- Generate a clean feed by suppressing white space and debugging information. ---> <cfprocessingdirective suppresswhitespace="yes"> <!--- Generate the JSON feed as a JavaScript function. ---> <cfcontent type="application/xml"> <cffunction access="private" name="getRss" returntype="any" > <cfargument name="rssFeedUrl"> <!--- Read in the rss from the url provided ---> <cfhttp method="get" url="#rssFeedUrl#" result="rssFeedData"> <cfreturn rssFeedData.fileContent> </cffunction> <cfscript> if(!IsDefined('feed')){ feed = ""; } // if // this is an example server-side proxy to load feeds if(feed.trim() == ""){ //theJSON = SerializeJSON('Elijah no loading occured'); xml = 'Elijah no loading occured'; } else{ if(FindNoCase(feed, 'http') == 0){ // Call to get the xml from the rss feed xml = XmlParse(getRss(feed)); xml = ReplaceNoCase(xml, '<content:encoded>', '<content>'); xml = ReplaceNoCase(xml, '</content:encoded>', '</content>'); xml = ReplaceNoCase(xml, '</dc:creator>', '</author>'); xml = ReplaceNoCase(xml, '<dc:creator', '<author'); } // if } // if </cfscript> </cfprocessingdirective> <cfoutput>#xml#</cfoutput>


Reply With Quote