private void parseLocation(XmlPullParser parser, SnapticNote note) throws XmlPullParserException, IOException { int eventType = parser.next(); while (eventType != XmlPullParser.END_DOCUMENT) { if (eventType == XmlPullParser.START_TAG) { String startTag = parser.getName(); if (XML_TAG_LATITUDE.equals(startTag)) { double latitude = Double.parseDouble(parser.nextText()); note.latitude = latitude; parse_trace("Latitude = " + note.latitude); } else if (XML_TAG_LONGITUDE.equals(startTag)) { double longitude = Double.parseDouble(parser.nextText()); note.longitude = longitude; parse_trace("Longitude = " + note.longitude); } else if (XML_TAG_ALTITUDE.equals(startTag)) { double altitude = Double.parseDouble(parser.nextText()); note.altitude = altitude; parse_trace("Altitude = " + note.altitude); } else if (XML_TAG_SPEED.equals(startTag)) { double speed = Double.parseDouble(parser.nextText()); note.speed = speed; parse_trace("Speed = " + note.speed); } else if (XML_TAG_BEARING.equals(startTag)) { double bearing = Double.parseDouble(parser.nextText()); note.bearing = bearing; parse_trace("Bearing = " + note.bearing); } else if (XML_TAG_ACCURACY_POSITION.equals(startTag)) { double accuracyPosition = Double.parseDouble(parser.nextText()); note.accuracyPosition = accuracyPosition; parse_trace("Positional accuracy = " + note.accuracyPosition); } else if (XML_TAG_ACCURACY_ALTITUDE.equals(startTag)) { double accuracyAltitude = Double.parseDouble(parser.nextText()); note.accuracyAltitude = accuracyAltitude; parse_trace("Altitude accuracy = " + note.accuracyAltitude); } else { parse_trace("(parseLocation) unknown XML tag: <" + startTag + ">"); } } else if (eventType == XmlPullParser.END_TAG) { String endTag = parser.getName(); if (XML_TAG_LOCATION.equals(endTag)) { parse_trace("Parsing geotag complete."); break; } } eventType = parser.next(); } }