Re: Failing gracefully when using xmlParse()...
You could use cfhttp to load the xml data into a variable, then parse the contents on a successful retrieval. --Ben Doom Che Vilnonis wrote: How can I fail gracefully when using xmlParse and the feed is not available/online? cfset xmlFeed = xmlParse(http://www.somedomainwithrssfeed.com/keyword.xml;) When using cfhttp, you could always use cfif findNoCase(200, cfhttp.statusCode) to test for success. How is it done with xmlParse? I'd rather not use a cftry/cfcatch block. Thanks, Che ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:300216 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: Failing gracefully when using xmlParse()...
How can I fail gracefully when using xmlParse and the feed is not available/online? cfset xmlFeed = xmlParse(http://www.somedomainwithrssfeed.com/keyword.xml;) Use try/catch. When using cfhttp, you could always use cfif findNoCase(200, cfhttp.statusCode) to test for success. How is it done with xmlParse? I'd rather not use a cftry/cfcatch block. Why? This is exactly what try/catch is for! Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ Fig Leaf Training: Adobe/Google/Paperthin Certified Partners http://training.figleaf.com/ WebManiacs 2008: the ultimate conference for CF/Flex/AIR developers! http://www.webmaniacsconference.com/ ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:300217 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: Failing gracefully when using xmlParse()...
OK. Just thought there might be some flag in the xmlparse function that might say there was a connection problem. -Original Message- From: Dave Watts [mailto:[EMAIL PROTECTED] Sent: Friday, February 29, 2008 2:15 PM To: CF-Talk Subject: RE: Failing gracefully when using xmlParse()... How can I fail gracefully when using xmlParse and the feed is not available/online? cfset xmlFeed = xmlParse(http://www.somedomainwithrssfeed.com/keyword.xml;) Use try/catch. When using cfhttp, you could always use cfif findNoCase(200, cfhttp.statusCode) to test for success. How is it done with xmlParse? I'd rather not use a cftry/cfcatch block. Why? This is exactly what try/catch is for! Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ Fig Leaf Training: Adobe/Google/Paperthin Certified Partners http://training.figleaf.com/ WebManiacs 2008: the ultimate conference for CF/Flex/AIR developers! http://www.webmaniacsconference.com/ ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:300218 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Failing gracefully when using xmlParse()...
Knew that. Thought xmlparse had something similar baked into it. -Original Message- From: Ben Doom [mailto:[EMAIL PROTECTED] Sent: Friday, February 29, 2008 2:09 PM To: CF-Talk Subject: Re: Failing gracefully when using xmlParse()... You could use cfhttp to load the xml data into a variable, then parse the contents on a successful retrieval. --Ben Doom Che Vilnonis wrote: How can I fail gracefully when using xmlParse and the feed is not available/online? cfset xmlFeed = xmlParse(http://www.somedomainwithrssfeed.com/keyword.xml;) When using cfhttp, you could always use cfif findNoCase(200, cfhttp.statusCode) to test for success. How is it done with xmlParse? I'd rather not use a cftry/cfcatch block. Thanks, Che ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:300219 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: Failing gracefully when using xmlParse()...
Yup. I hear ya. I just thought I might be able to write a few less lines of code. :) No biggie... -Original Message- From: Brad Wood [mailto:[EMAIL PROTECTED] Sent: Friday, February 29, 2008 2:17 PM To: CF-Talk Subject: RE: Failing gracefully when using xmlParse()... Xmlparse assumes that any preliminary checks and validations have been performed and that the string being passed in is well-formed XML. I can see what you are saying, but xmlparse could receive its input from absolutely anywhere so it wouldn't really work very well for xmlparse to try and catch those errors. The onus is on the programmer to ensure they have well-formed XML before they knock on xmlparse's door. ~Brad ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:300224 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: Failing gracefully when using xmlParse()...
Xmlparse assumes that any preliminary checks and validations have been performed and that the string being passed in is well-formed XML. I can see what you are saying, but xmlparse could receive its input from absolutely anywhere so it wouldn't really work very well for xmlparse to try and catch those errors. The onus is on the programmer to ensure they have well-formed XML before they knock on xmlparse's door. ~Brad -Original Message- From: Che Vilnonis [mailto:[EMAIL PROTECTED] Sent: Friday, February 29, 2008 1:15 PM To: CF-Talk Subject: RE: Failing gracefully when using xmlParse()... Knew that. Thought xmlparse had something similar baked into it. ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:300223 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Failing gracefully when using xmlParse()...
Che Vilnonis wrote: I'd rather not use a cftry/cfcatch block. Thanks, Che Why not? It's the first thing that popped into my mind and seems eminently appropriate. If you want to do something differently then the generally accepted way to do something, then it would help to know the reason you desire to buck the general consensus? I've not played with cffeed can it work off of a cfhttp result, allowing you to use the 200 status? ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:300222 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4