House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Mailing Lists
Home / Groups / ColdFusion Talk (CF-Talk)

Google Weather API XML Question: Getting the value of a node

Author:
Azadi Saryev
03/19/2010 11:25 PM

just 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> > > >


Search cf-talk

February 11, 2012

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
       1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29