I have been trying to figure this one out for a while now. Running the below
code will bring back a valid XML string and the XmlParse() is working just
fine. The problem is trying to get the value for Condition in the <cfscript>.
The error I'm getting is: Element
XML_API_REPLY.WEATHER.CURRENT_CONDITIONS.CONDITION.XMLATTRIBUTES.DATA is
undefined in XMLGOOGLE.
I have tried every way I could thing of to address getting at the value, but
with no luck.
I would appreciate another set or two of eyes on this.
Thanks
<cftry>
<cfset urlAddress="http://www.google.com/ig/api?weather=21787">
<cfhttp url="#urladdress#" result="myResponse" />
<cfdump var="#myResponse.FileContent#">
<cfset xmlGoogle = XmlParse(myResponse.FileContent)>
<cfdump var="#xmlGoogle#" expand="no">
<cfscript>
Condition =
xmlGoogle.xml_api_reply.weather.current_conditions.condition.xmlAttributes.data;
</cfscript>
<cfoutput>
<p>#Condition#</p>
</cfoutput>
<cfcatch type="any">
<cfdump var="#cfcatch#">
</cfcatch>
</cftry>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know
on the House of Fusion mailing lists
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:331913
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm