Minimalist GPX Parser

Following a number of inquiries about how I'm dealing with GPS data in GPX format, here's a snapshot of my minimalist GPX parser (which is now officially stalled due to the end of my vacation). Like most of my stuff, it has zero dependencies (I went with minidom since it gave me nice, easy to handle element lists):

import sys, string
from xml.dom import minidom, Node

class GPXParser:
  def __init__(self, filename):
    self.tracks = {}
      doc = minidom.parse(filename)
      return # handle this properly later
    gpx = doc.documentElement
    for node in gpx.getElementsByTagName('trk'):

  def parseTrack(self, trk):
    name = trk.getElementsByTagName('name')[0]
    if not name in self.tracks:
      self.tracks[name] = {}
    for trkseg in trk.getElementsByTagName('trkseg'):
      for trkpt in trkseg.getElementsByTagName('trkpt'):
        lat = float(trkpt.getAttribute('lat'))
        lon = float(trkpt.getAttribute('lon'))
        ele = float(trkpt.getElementsByTagName('ele')[0]
        rfc3339 = trkpt.getElementsByTagName('time')[0]

  def getTrack(self, name):
    times = self.tracks[name].keys()
    points = [self.tracks[name][time] for time in times.sort()]
    return [(point['lat'],point['lon']) for point in points]

This is just the basics - KML generation from here on is trivial, but rather verbose, so I clipped it.

More on this later (depending on free time).