@Nullable
    private static Geopoint[] parseGpxTrack(@NonNull final String gpx, final Geopoint destination, @Nullable final ArrayList<Float> elevation) {
        try {
            final LinkedList<Geopoint> result = new LinkedList<>();

            final String namespace = "http://www.topografix.com/GPX/1/1";
            final RootElement root = new RootElement(namespace, "gpx");
            final Element trk = root.getChild(namespace, "trk");
            final Element trkseg = trk.getChild(namespace, "trkseg");
            final Element trkpt = trkseg.getChild(namespace, "trkpt");
            final Element ele = trkpt.getChild(namespace, "ele");

            trkpt.setStartElementListener(attributes -> {
                final String lat = attributes.getValue("lat");
                if (lat != null) {
                    final String lon = attributes.getValue("lon");
                    if (lon != null) {
                        result.add(new Geopoint(lat, lon));
                    }
                }
            });

            ele.setEndTextElementListener(body -> {
                if (elevation != null) {
                    elevation.add(Float.parseFloat(body));
                }
            });

            Xml.parse(gpx, root.getContentHandler());

            // artificial straight line from track to target
            if (destination != null) {
                result.add(destination);
                if (elevation != null) {
                    elevation.add(Float.NaN);
                }
            }
            return result.toArray(new Geopoint[0]);

        } catch (SAXException e) {
            Log.w("cannot parse brouter output of length " + gpx.length() + ", gpx=" + gpx, e);
        }
        return null;
    }
Return a valid track (with at least two points, including the start and destination).
no caching

@param start       the starting point
@param destination the destination point
@param elevation   the variable to write elevation info to (null, if no elevation info to be returned)
@return a track with at least two points including the start and destination points
main/src/main/java/cgeo/geocaching/maps/routing/Routing.java