この URL に投稿する必要があるアプリケーションを作成しています: Url to get KML
このチュートリアルによると、URL は KML ファイルを返すことになっています。
しかし、URL にアクセスすると、応答としてHTMLファイルが返されますが、これは解析が非常に難しく、役に立ちません。
私のソースコードは次のとおりです。
//Calling function to get the response KML
getKmlFromUrl("https://maps.google.com/maps?saddr=22.583375060000,88.434077990000&daddr=22.491368100000,88.348189300000&ie=UTF8&0&om=0&output=kml");
//KMLファイルを取得してlogcatに表示する関数です void getKmlFromUrl(String urlString) { String kml = null;
try {
// defaultHttpClient
DefaultHttpClient httpClient = new DefaultHttpClient();
makeAToast("URL:"+urlString);
HttpPost httpPost = new HttpPost(urlString);
HttpResponse httpResponse = httpClient.execute(httpPost);
HttpEntity httpEntity = httpResponse.getEntity();
kml = EntityUtils.toString(httpEntity);
System.out.println("KML: "+kml);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
// // return XML
// // return xml;
}
これらすべてを行った後、KML応答が得られず、代わりにHTML応答が得られます。応答 (logcat 内) は次のとおりです。
どこが間違っていますか?