Hello, I've written a simple Yahoo RSS XML parser which you can see here: http://www.warrick.net/yahoo_rss_reader.cfm
If you enter a search term that matches current news, the script works fine. However, if there are no matching stories, the XML returned is incomplete and an error is returned stating that some part of the XML that the code references is missing. I've tried evaluating the cfhttp.filecontent for the existence of certain things such as "We did not find results for" which you can see if you click through on the link this script generates. But the error still occurs. So what I need is some sort of error checking which will stop the XML from parsing if no news results are returned. Here's the script so far. Thanks! ---mark <cfoutput> <form action="#script_name#" method="post"> <input type="text" name="search_term" size="30" /> <input type="submit" value="Display Yahoo News Articles" /> </form><br /> <br /> </cfoutput> <cfparam name="RSS_URL" default=""> <cfparam name="search_term" default=""> <cfif search_term neq ""> <cfset search_term = #Replace(search_term, " ", "+", "All")#> </cfif> <cfif search_term neq ""> <cfset RSS_URL = "http://news.search.yahoo.com/news/rss?p=#search_term#&ei=UTF-8&fl=0&x=wrt"> <cfhttp throwonerror="yes" url="#rss_url#" method="get" timeout="10"></cfhttp> <!--- <cfoutput>#cfhttp.filecontent#</cfoutput> ---> <cfif cfhttp.filecontent does not contain "gif false"> <cfset xmlDoc = XMLParse(cfhttp.filecontent)> <!--- <cfdump var="#xmldoc#"> ---> <cfoutput> #xmlDoc.rss.channel.title.xmlText#<br> <a href="#xmlDoc.rss.channel.link.xmlText#">#xmlDoc.rss.channel.link.xmlText#</a><br> #xmlDoc.rss.channel.lastBuildDate.xmlText#<br> <hr> <cfloop from="1" to="#ArrayLen(xmlDoc.rss.channel.item)#" index="i"> <p> <a href="#xmlDoc.rss.channel.item[i].link.xmlText#">#xmlDoc.rss.channel.item[i].title.xmlText#</a><br /> #xmlDoc.rss.channel.item[i].description.xmlText#<br /> </p> </cfloop> </cfoutput> </cfif> </cfif> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Discover CFTicket - The leading ColdFusion Help Desk and Trouble Ticket application http://www.houseoffusion.com/banners/view.cfm?bannerid=48 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:227015 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54