Getting an error on occasion on a specific CF page. Offending code listed below. Very odd because when I rebooted CF it went away. Can the XML be checked via XMLValidate to prevent this from happening?
Is this some sort of CF bug since the error disappeared after reboot of CF? I have a feeling that the error will resurface at some point.
An error occured while Parsing an XML document. The element type "meta" must be terminated by the matching end-tag "".
<cfhttp method="get" url="http://bs.mysite.com/webservice/rec/get.sbs?customerId=345S4BE8x&itemId=#product_id#&number=20&ruleId=#product.location_tab_accessories#">
<cfset result = xmlParse(cfhttp.FileContent)>
<cfset recs = xmlSearch(result, "/result/thsite/site/itemId")>
You can use XmlValidate() to validate a xml doc against a DTD or a Schema. XmlParse() itself validates the document and throws an error if the xml is not well formed. It also supports a validator parameter as of CF7. Use cftry/cfcatch to handle the exception.
The error message you received indicates that you didn't receive the XML document you expected, but a HTML page with unclosed meta tags in it. Maybe this could be a error page or some other html page you've been redirected to.
Did something change with DNS/IP of the target URL? Cfhttp does DNS caching (the underlying JVM does) and this can lead to strange effects like you experienced here. Restarting ColdFusion clears the cache, the url is resolved again and your request will be successful.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With