|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Yahoo RSS News Feed Help!
I was wondering if anyone could help me with this?
I want to use yahoos news feeds on my site. When I put a direct URL link to an XML file on my computers CFMX Server It works. Example: <CFHTTP URL="http://localhost:8500/news/health.xml" METHOD="get" RESOLVEURL="no"/> Now when I direct the URL link to Yahoos feed it comes up with an error saying that a Document root element is missing! Can anyone help me with this. Here Is my code: <CFHTTP URL="http://rss.news.yahoo.com/rss/health" METHOD="get" RESOLVEURL="no"/> <CFSCRIPT> objRSS = trim(cfhttp.filecontent); objRSS = XMLParse(objRSS); </CFSCRIPT> <CFSET XMLRoot = objRSS.XmlRoot > <CFSET News_Length = arraylen(XMLRoot.channel.item) > <CFLOOP index="i" from="1" to="#News_Length#" > <CFSET item_title = XMLRoot.channel.item.title.xmltext > <CFSET item_link = XMLRoot.channel.item.link.xmltext > <CFSET item_pubDate = XMLRoot.channel.item.pubDate.xmltext > <CFSET item_description = XMLRoot.channel.item.description.xmltext > <CFOUTPUT> <STRONG>#item_title#</STRONG><br/> #item_pubDate#<br/> <a href="#item_link#">#item_description#</a><br/> <br/> </CFOUTPUT> </CFLOOP> Thanks area215 |
|
#2
|
|||
|
|||
|
You're just not using the correct XML root element. Try using the <rss> or the <channel> element. Remember that XML objects are referenced in array and structure syntax like someelement[1].subelement[1].
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > Yahoo RSS News Feed Help! |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|