diff --git a/main.go b/main.go index 6e91631..eb4b953 100644 --- a/main.go +++ b/main.go @@ -9,6 +9,7 @@ import ( "io" "log" "os" + "strings" "time" "github.com/metalnem/runtastic/api" @@ -27,6 +28,15 @@ var ( // Error is used for logging errors. Error = log.New(os.Stderr, "ERROR: ", log.Ldate|log.Ltime) + + schemaLocation = strings.Join([]string{ + "http://www.topografix.com/GPX/1/1", + "http://www.topografix.com/GPX/1/1/gpx.xsd", + "http://www.garmin.com/xmlschemas/GpxExtensions/v3", + "http://www.garmin.com/xmlschemas/GpxExtensionsv3.xsd", + "http://www.garmin.com/xmlschemas/TrackPointExtension/v1", + "http://www.garmin.com/xmlschemas/TrackPointExtensionv1.xsd", + }, " ") ) type rfc3339Time struct { @@ -43,11 +53,11 @@ type trackPoint struct { type gpx struct { XMLName xml.Name `xml:"http://www.topografix.com/GPX/1/1 gpx"` - SchemaInstance string `xml:"xmlns:xsi,attr"` - SchemaLocation string `xml:"xsi:schemaLocation,attr"` - Extension string `xml:"xmlnss:gpxtpx,attr"` Version float32 `xml:"version,attr"` Creator string `xml:"creator,attr"` + SchemaInstance string `xml:"xmlns:xsi,attr"` + SchemaLocation string `xml:"xsi:schemaLocation,attr"` + Extension string `xml:"xmlns:gpxtpx,attr"` Time rfc3339Time `xml:"metadata>time"` TrackPoints []trackPoint `xml:"trk>trkseg>trkpt"` } @@ -123,7 +133,7 @@ func archive(filename string, activities []api.Activity) (err error) { data := gpx{ SchemaInstance: "http://www.w3.org/2001/XMLSchema-instance", - SchemaLocation: "http://www.topografix.com/GPX/1/1", + SchemaLocation: schemaLocation, Extension: "http://www.garmin.com/xmlschemas/TrackPointExtension/v1", Version: 1.1, Creator: "Runtastic Archiver, https://github.com/Metalnem/runtastic",