7 Replies Latest reply on Oct 30, 2008 9:24 AM by Newsgroup_User

    Processing  google weather XML file Information

    bemall
      Google weather APi returns an XML file that I would like to process and store content into a database. You can view sample xml file by entering this in your browser .. http://www.google.com/ig/api?weather=chicago

      How can I go about retrieveing the xml file and storing into a database ..This is wahat I have so far, let me know how to proceed since this does not work ..


      <!--- Set the URL address. --->
      <cfset urlAddress=" http://www.google.com/ig/api?weather=chicago">
      <cfhttp url="#urladdress#" method="GET" resolveurl="Yes" throwOnError="Yes"/>


      <cfset xmlDoc = XmlParse(CFHTTP.FileContent)><!--- THIS DOES NOT RETURN ANY CONTENT????. --->


      <!--- Get the array of resource elements, the xmlChildren of the xmlroot. --->
      <cfset resources=xmlDoc.xmlroot.xmlChildren>
      <cfset numresources=ArrayLen(resources)>

      <cfloop index="i" from="1" to="#numresources#">
      <cfset item=resources >
      <cfoutput>
      <strong><a href=#item.url.xmltext#>#item.title.xmltext#</strong></a><br>
      <strong>Author</strong>  #item.author.xmltext#<br>
      <strong>Applies to these products</strong><br>
      <cfloop index="i" from="4" to="#arraylen(item.xmlChildren)#">
      #item.xmlChildren
      .xmlAttributes.Name#<br>
      </cfloop>
      <br>
      </cfoutput>
      </cfloop>