|
Mailing Lists
|
Home / Groups / ColdFusion Talk (CF-Talk)
Google Weather API XML Question: Getting the value of a nodejust replace 'xml_api_reply' with 'xmlroot' (without the quotes, of course): Condition = xmlGoogle.xmlroot.weather.current_conditions.condition.xmlAttributes.data; Azadi On 20/03/2010 10:33, Chuck Weidler wrote: > 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> > > > |
February 11, 2012
|
Latest Fusion Authority Articles
|
|||||||||||||||||||||||||||||||||||||||||||||||||