On 20/03/2010 13: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.
try this:
<cftry>
<cfset urlAddress="http://www.google.com/ig/api?weather=21787">
<cfhttp url="#urladdress#" result="myResponse" />
<cfdump var="#myResponse.FileContent#">
<cfset xmlGoogle =
XmlSearch(XmlParse(myResponse.FileContent),"/xml_api_reply/weather/current_conditions/condition")>
<cfdump var="#xmlGoogle#" expand="no">
<cfscript>
Condition = xmlGoogle[1].xmlAttributes.data;
</cfscript>
<cfoutput>
<p>#Condition#</p>
</cfoutput>
<cfcatch type="any">
<cfdump var="#cfcatch#">
</cfcatch>
</cftry>
--
Yours,
Kym Kovan
mbcomms.net.au
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:331914
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm