Ok, so I figured why my xmlSearch was not working - there are two default
namespaces in the xml and a namespace mapping is required to reference them
through XPath. After searching for some time on how to map namespaces with
ColdFusion I gave up and used:

//[local-name()="AddressDetails"]/* etc

My XPath query ended up huge and unreadable but it worked. Any ideas on how
to map namespaces for XPath searches in ColdFusion?

Dominic

On 05/03/2008, Dominic Watson <[EMAIL PROTECTED]> wrote:
>
> I am having trouble searching this xml string returned from the google
> maps geocoding service. The reason is to do with the xmlns for the
> AddressDetails XML. Here is the xml (I wish I could tab it!):
>
>
> <?
> xml version="1.0" encoding="UTF-8"?>
> <kml xmlns="http://earth.google.com/kml/2.0";>
> <Response>
>  <name>godalming, surrey, GB</name>
>  <Status>
>  <code>200</code>
>  <request>geocode</request>
>  </Status>
>
>  <Placemark id="p1">
>  <address>Godalming, Surrey, UK</address>
>
> <!-- THE TROUBLESOME BIT -->
> <AddressDetails Accuracy="4" xmlns="urn:oasis:names:tc:ciq:xsdschema:xAL:
> 2.0"> <Country>
>  <CountryNameCode>GB</CountryNameCode>
>  <AdministrativeArea>
>  <AdministrativeAreaName>England</AdministrativeAreaName>
>  <SubAdministrativeArea>
>  <SubAdministrativeAreaName>Surrey</SubAdministrativeAreaName>
>  <Locality>
>  <LocalityName>Godalming</LocalityName>
>  </Locality>
>  </SubAdministrativeArea>
>  </AdministrativeArea>
>  </Country>
> </AddressDetails>
>
> <Point>
>  <coordinates>-0.617529,51.184425,0</coordinates>
> </Point>
> </Placemark>
> </Response>
> </kml>
> Ok, so doing like this gets a result: <cfset foo = XMLSearch(theXml,
> "//:Response")
> But this won't: <cfset foo = XMLSearch(theXml, "//:AddressDetails")>
>
> How should I be referencing the AddressDetails nodes? (I have double
> checked case sensitivity, not the problem)
>
> Thanks in advance,
>
> Dominic
>
> --
> Blog it up: http://fusion.dominicwatson.co.uk
>



-- 
Blog it up: http://fusion.dominicwatson.co.uk


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:300625
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to