小编Raj*_*san的帖子

未终止的实体引用错误

我正在使用谷歌地图路线为我自己的Android应用程序.2天前它运行良好,但在那之后应用程序运行时它通过logcat给我错误.任何机构都可以告诉我这个问题的原因和解决方案.

org.xml.sax.SAXParseException: unterminated entity ref (position:ENTITY_REF &@1:799 in java.io.InputStreamReader@406cdeb0)
Run Code Online (Sandbox Code Playgroud)
private String[] getDirectionData(String sourceLat, String sourceLong, String destinationLat, String destinationLong) {


 String urlString = "http://maps.google.com/maps?f=d&hl=en&" +"saddr="+sourceLat+","+sourceLong+"&daddr="+destinationLat+","+destinationLong + "&ie=UTF8&0&om=0&output=kml";
 Log.d("URL", urlString);
 Document doc = null;
 HttpURLConnection urlConnection = null;
 URL url = null;
 String pathConent = "";

 try {

  url = new URL(urlString.toString());
  urlConnection = (HttpURLConnection) url.openConnection();
  urlConnection.setRequestMethod("GET");
  urlConnection.setDoOutput(true);
  urlConnection.setDoInput(true);
  urlConnection.connect();
  DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
  DocumentBuilder db = dbf.newDocumentBuilder();
  doc = db.parse(urlConnection.getInputStream());

 } catch (Exception e) {

     Log.w("Error in google map",e);
 } …
Run Code Online (Sandbox Code Playgroud)

android

5
推荐指数
2
解决办法
1万
查看次数

标签 统计

android ×1