X-Git-Url: http://gitweb.fperrin.net/?a=blobdiff_plain;f=tim%2Fprune%2Fload%2Fxml%2FGpxHandler.java;fp=tim%2Fprune%2Fload%2Fxml%2FGpxHandler.java;h=962b495741909fb0e46c1fc07c62c254df18a3d1;hb=5625a1abadb5f2ca5f017fe7dbda1d5141cb637b;hp=0000000000000000000000000000000000000000;hpb=23959e65a6a0d581e657b07186d18b7a1ac5afeb;p=GpsPrune.git diff --git a/tim/prune/load/xml/GpxHandler.java b/tim/prune/load/xml/GpxHandler.java new file mode 100644 index 0000000..962b495 --- /dev/null +++ b/tim/prune/load/xml/GpxHandler.java @@ -0,0 +1,157 @@ +package tim.prune.load.xml; + +import java.util.ArrayList; + +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +import tim.prune.data.Field; + + +/** + * Class for handling specifics of parsing Gpx files + */ +public class GpxHandler extends XmlHandler +{ + private boolean _insideName = false; + private boolean _insideElevation = false; + private boolean _insideTime = false; + private String _name = null, _latitude = null, _longitude = null; + private String _elevation = null; + private String _time = null; + private ArrayList _pointList = new ArrayList(); + + + /** + * Receive the start of a tag + * @see org.xml.sax.ContentHandler#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes) + */ + public void startElement(String uri, String localName, String qName, + Attributes attributes) throws SAXException + { + // Read the parameters for waypoints and track points + if (qName.equalsIgnoreCase("wpt") || qName.equalsIgnoreCase("trkpt")) + { + int numAttributes = attributes.getLength(); + for (int i=0; i