I have users that input data that is sometimes is not correct. For
instance they might misspell their city or they might write 'St John'
instead of 'St. John'. I would rather not dirty up my database so I
would like to check with Google to see if what the user inputted was
correct.

How do I extract the city 'Mountain View' from the below code? I think
I am getting close but I am not good at parsing XML.

<cfhttp
    url="http://maps.googleapis.com/maps/api/geocode/xml?
address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&sensor=true"
    method="GET" resolveurl="No" timeout="30" throwonerror="yes">
</cfhttp>
<cfset xmlDoc = XmlParse(CFHTTP.FileContent)>

<cfloop
    index="address_component"
    from="1"
    to="#ArrayLen( xmlDoc.GeocodeResponse.XmlChildren )#"
    step="1">

    <!--- Get a short hand for the current rentalad node. --->
    <cfset xmladdress_component =
xmlDoc.GeocodeResponse[ "address_component" ][ address_component ] /
>
    <!--- Get the contactinfo children. --->
    <cfset xmlLong_name = xmladdress_component[ "long_name" ] />

    <cfoutput>
        #xmlAddress_component.long_name.xmltext#<br />
    </cfoutput>

</cfloop>

<CFDUMP var="#xmlDoc#">

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" group.
To post to this group, send email to google-maps-js-api-v3@googlegroups.com.
To unsubscribe from this group, send email to 
google-maps-js-api-v3+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Reply via email to