code: @Override
      public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
          if (localName.equalsIgnoreCase(GPXTags.TRKSEG)) {
              segment = true;
              GPXLine trkSegment = new GPXLine(GpxMetadata.TRKSEGFIELDCOUNT);
              trkSegment.setValue(GpxMetadata.LINEID, trksegID++);
              trkSegment.setValue(GpxMetadata.TRKSEG_TRKID, getCurrentLine().getValues()[GpxMetadata.LINEID]);
              setCurrentSegment(trkSegment);
              trksegList.clear();
          } else if (localName.equalsIgnoreCase(GPXTags.TRKPT)) {
              point = true;
              GPXPoint trackPoint = new GPXPoint(GpxMetadata.TRKPTFIELDCOUNT);
              Coordinate coordinate = GPXCoordinate.createCoordinate(attributes);
              Point geom = getGeometryFactory().createPoint(coordinate);
              geom.setSRID(4326);
              trackPoint.setValue(GpxMetadata.THE_GEOM, geom);
              trackPoint.setValue(GpxMetadata.PTLAT, coordinate.y);
              trackPoint.setValue(GpxMetadata.PTLON, coordinate.x);
              trackPoint.setValue(GpxMetadata.PTELE, coordinate.z);
              trackPoint.setValue(GpxMetadata.PTID, trkptID++);
              trackPoint.setValue(GpxMetadata.TRKPT_TRKSEGID, trksegID);
              trksegList.add(coordinate);
              setCurrentPoint(trackPoint);
          }
          // Clear content buffer
          getContentBuffer().delete(0, getContentBuffer().length());
          // Store name of current element in stack
          getElementNames().push(qName);
      }
docs: Fires whenever an XML start markup is encountered. It creates a new
  trackSegment when a <trkseg> markup is encountered. It creates a new
  trackPoint when a <trkpt> markup is encountered. It saves informations
  about <link> in currentPoint or currentLine.
  
  @param uri URI of the local element
  @param localName Name of the local element (without prefix)
  @param qName qName of the local element (with prefix)
  @param attributes Attributes of the local element (contained in the
  markup)
  @throws SAXException Any SAX exception, possibly wrapping another
  exception