private static WptPt parseWptAttributes(XmlPullParser parser) { WptPt wpt = new WptPt(); try { wpt.lat = Double.parseDouble(parser.getAttributeValue("", "lat")); // $NON-NLS-1$ //$NON-NLS-2$ wpt.lon = Double.parseDouble(parser.getAttributeValue("", "lon")); // $NON-NLS-1$ //$NON-NLS-2$ } catch (NumberFormatException e) { } return wpt; }
private static void writeWpt(SimpleDateFormat format, XmlSerializer serializer, WptPt p) throws IOException { serializer.attribute(null, "lat", latLonFormat.format(p.lat)); // $NON-NLS-1$ //$NON-NLS-2$ serializer.attribute(null, "lon", latLonFormat.format(p.lon)); // $NON-NLS-1$ //$NON-NLS-2$ if (!Double.isNaN(p.ele)) { writeNotNullText(serializer, "ele", p.ele + ""); } writeNotNullText(serializer, "name", p.name); writeNotNullText(serializer, "category", p.category); writeNotNullText(serializer, "desc", p.desc); if (!Double.isNaN(p.hdop)) { writeNotNullText(serializer, "hdop", p.hdop + ""); } if (p.time != 0) { writeNotNullText(serializer, "time", format.format(new Date(p.time))); } if (p.speed > 0) { p.getExtensionsToWrite().put("speed", p.speed + ""); } writeExtensions(serializer, p); }