Excluded object reference error

I use google map route for my own android application. 2 days ago it worked well, but after that, when the application starts it, I give me errors via logcat. Can any body tell me the reason and solution to this problem.

org.xml.sax.SAXParseException: unterminated entity ref (position:ENTITY_REF &@1:799 in java.io.InputStreamReader@406cdeb0)

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);
 }

 NodeList nl = doc.getElementsByTagName("LineString");
 for (int s = 0; s < nl.getLength(); s++) {
  Node rootNode = nl.item(s);
  NodeList configItems = rootNode.getChildNodes();
  for (int x = 0; x < configItems.getLength(); x++) {
   Node lineStringNode = configItems.item(x);
   NodeList path = lineStringNode.getChildNodes();
   pathConent = path.item(0).getNodeValue();
  }
 }
 String[] tempContent = pathConent.split(" ");
 return tempContent;
}
+5
source share
6 answers

In my case, this problem appeared in the .png file inside / res / drawable. This is a mistake, and has been reported here . So, for future reference, if you come across it whenever possible, check this out. To summarize, upgrade your ADT to at least version 21.0.1.

+7
source

. , "&" .

+2

, , , output = kml , .

+1

: ref , . <ref> </ref>. XML- this.

0

. , KML Google . , GeometryCollection. - , SAXParseException: unterminited entity ref.

API . .

kml . , , . , kml Chrome, .

0

I have the same problem. It was in a PNG image file. The problem arose after I edited the file. I was looking for a solution, but after that I cleaned up my project using the "clean .." option on the "project" tab. And finally, I got rid of this "

0
source

All Articles