Commit 33cf3bc9 authored by Danielle Madeley's avatar Danielle Madeley Committed by Ross Burton

Fix HostIP provider to work with latest web API

The web API from api.hostip.info has removed the 'hostip' namespace. All of
the XPath queries required updating to remove the hostip namespace, otherwise
they don't match anything.
parent 73b67296
......@@ -42,13 +42,11 @@
#define HOSTIP_NS_GML_NAME "gml"
#define HOSTIP_NS_GML_URI "http://www.opengis.net/gml"
#define HOSTIP_NS_HOSTIP_NAME "hostip"
#define HOSTIP_NS_HOSTIP_URI "http://www.hostip.info/api"
#define HOSTIP_COUNTRY_XPATH "//gml:featureMember/hostip:Hostip/hostip:countryName"
#define HOSTIP_COUNTRYCODE_XPATH "//gml:featureMember/hostip:Hostip/hostip:countryAbbrev"
#define HOSTIP_LOCALITY_XPATH "//gml:featureMember/hostip:Hostip/gml:name"
#define HOSTIP_LATLON_XPATH "//gml:featureMember/hostip:Hostip//gml:coordinates"
#define HOSTIP_COUNTRY_XPATH "//gml:featureMember/Hostip/countryName"
#define HOSTIP_COUNTRYCODE_XPATH "//gml:featureMember/Hostip/countryAbbrev"
#define HOSTIP_LOCALITY_XPATH "//gml:featureMember/Hostip/gml:name"
#define HOSTIP_LATLON_XPATH "//gml:featureMember/Hostip//gml:coordinates"
static void geoclue_hostip_init (GeoclueHostip *obj);
static void geoclue_hostip_position_init (GcIfacePositionClass *iface);
......@@ -101,7 +99,6 @@ geoclue_hostip_get_position (GcIfacePosition *iface,
return FALSE;
}
if (gc_web_service_get_string (obj->web_service,
&coord_str, HOSTIP_LATLON_XPATH)) {
if (sscanf (coord_str, "%lf,%lf", longitude , latitude) == 2) {
......@@ -240,8 +237,6 @@ geoclue_hostip_init (GeoclueHostip *obj)
gc_web_service_set_base_url (obj->web_service, HOSTIP_URL);
gc_web_service_add_namespace (obj->web_service,
HOSTIP_NS_GML_NAME, HOSTIP_NS_GML_URI);
gc_web_service_add_namespace (obj->web_service,
HOSTIP_NS_HOSTIP_NAME, HOSTIP_NS_HOSTIP_URI);
}
static void
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment