Sub LoadFile_Click
Dim fd As FileDialog
fd.FastScroll = True
fd.FilePath = ""
fd.FileFilter = ".gpx"
ret = fd.Show("Choose a .gpx file", "Yes", "No", "", Null)
If ret=-1 Then
Dim FileToStr As String
FileToStr=File.ReadString(fd.FilePath, fd.ChosenName)
Msgbox(FileToStr,"") 'just to see what I'm doing
Else
Activity.Finish
End If
'parse the xml file
Dim In As InputStream
In = File.OpenInput(fd.FilePath, fd.ChosenName)
parser.Parse(In, "Parser")
In.Close
End Sub
Sub Parser_StartElement (Uri As String, Name As String, Attributes As Attributes)
If Name="trkpt" Then
lati = Attributes.GetValue2("","lat")
Log(lati)
loni = Attributes.GetValue2("","lon")
Log(loni)
End If
End Sub
Sub Parser_EndElement (Uri As String, Name As String, Text As StringBuilder)
If parser.Parents.IndexOf("trkpt") > -1 Then
If Name = "ele" Then
elevation = Text.ToString
Log(elevation)
Else If Name = "time" Then
timestamp = Text.ToString
Log (timestamp)
End If
End If
If Name = "trkpt" Then
Log(elevation)
Log(timestamp)
End If
End Sub