From: <jb...@us...> - 2009-09-25 11:45:31
|
Revision: 361 http://pytrainer.svn.sourceforge.net/pytrainer/?rev=361&view=rev Author: jblance Date: 2009-09-25 11:45:17 +0000 (Fri, 25 Sep 2009) Log Message: ----------- Added XSL validation to plugin branch Modified Paths: -------------- pytrainer/branches/plugins-v2/plugins/garmin-gpx/garmingpx.py pytrainer/branches/plugins-v2/plugins/garmin-hr-file/garminhrfile.py pytrainer/branches/plugins-v2/pytrainer/main.py pytrainer/branches/plugins-v2/pytrainer/plugins.py Added Paths: ----------- pytrainer/branches/plugins-v2/pytrainer/lib/xmlValidation.py pytrainer/branches/plugins-v2/schemas/ pytrainer/branches/plugins-v2/schemas/Cluetrust_gpxdata10.xsd pytrainer/branches/plugins-v2/schemas/GarminTrainingCenterDatabase_v1-gpsbabel.xsd pytrainer/branches/plugins-v2/schemas/GarminTrainingCenterDatabase_v1.xsd pytrainer/branches/plugins-v2/schemas/GarminTrainingCenterDatabase_v2.xsd pytrainer/branches/plugins-v2/schemas/README pytrainer/branches/plugins-v2/schemas/Topografix_gpx11.xsd pytrainer/branches/plugins-v2/schemas/validate_gpsfile.py Modified: pytrainer/branches/plugins-v2/plugins/garmin-gpx/garmingpx.py =================================================================== --- pytrainer/branches/plugins-v2/plugins/garmin-gpx/garmingpx.py 2009-09-25 10:22:03 UTC (rev 360) +++ pytrainer/branches/plugins-v2/plugins/garmin-gpx/garmingpx.py 2009-09-25 11:45:17 UTC (rev 361) @@ -19,6 +19,7 @@ #Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. import logging +import os from gui.dialogs import fileChooserDialog, guiFlush import xml.etree.cElementTree @@ -27,22 +28,38 @@ Expects only one activity in each file Checks to see if any entries are in the database with the same start time """ - def __init__(self, parent = None): + def __init__(self, parent = None, validate=False): self.parent = parent self.tmpdir = self.parent.conf.getValue("tmpdir") + self.validate = validate def run(self): selectedFiles = fileChooserDialog(title="Choose a GPX file (or files) to import", multiple=True).getFiles() guiFlush() importFiles = [] for filename in selectedFiles: - if not self.inDatabase(filename): - importFiles.append(filename) + if self.valid_input_file(filename): + if not self.inDatabase(filename): + importFiles.append(filename) + else: + logging.debug("%s already in database. Skipping import." % (filename,) ) else: - print "%s already in database. Skipping import." % (filename,) - logging.debug("%s already in database. Skipping import." % (filename,) ) + logging.debug("Invalid input file %s" % (filename)) return importFiles + def valid_input_file(self, filename): + """ Function to validate input file if requested""" + if not self.validate: + #not asked to validate + return True + else: + #To validate GPX as used for pytrainer must test against both Topograpfix and Cluetrust + topografixXSLfile = os.path.realpath(self.parent.parent.data_path)+ "/schemas/Topografix_gpx11.xsd" + cluetrustXSLfile = os.path.realpath(self.parent.parent.data_path)+ "/schemas/Cluetrust_gpxdata10.xsd" + from lib.xmlValidation import xmlValidator + validator = xmlValidator() + return validator.validateXSL(filename, topografixXSLfile) and validator.validateXSL(filename, cluetrustXSLfile) + def inDatabase(self, filename): #comparing date and start time (sport may have been changed in DB after import) time = self.detailsFromGPX(filename) Modified: pytrainer/branches/plugins-v2/plugins/garmin-hr-file/garminhrfile.py =================================================================== --- pytrainer/branches/plugins-v2/plugins/garmin-hr-file/garminhrfile.py 2009-09-25 10:22:03 UTC (rev 360) +++ pytrainer/branches/plugins-v2/plugins/garmin-hr-file/garminhrfile.py 2009-09-25 11:45:17 UTC (rev 361) @@ -34,10 +34,11 @@ Note: using lxml see http://codespeak.net/lxml """ - def __init__(self, parent = None): + def __init__(self, parent = None, validate=False): self.parent = parent self.tmpdir = self.parent.conf.getValue("tmpdir") self.data_path = os.path.dirname(__file__) + self.validate = validate def run(self): selectedFiles = fileChooserDialog(title="Choose a Garmin Training Center file to import").getFiles() @@ -46,15 +47,29 @@ if not selectedFiles: return importfiles for filename in selectedFiles: #could be multiple files selected - currently only single selection enabled - tracks = self.getTracks(filename) - logging.debug("Found %d tracks in %s" % (len(tracks), filename)) - for track in tracks: #can be multiple tracks - if shouldImport(track): - gpxfile = "%s/garminhrfile%d.gpx" % (self.tmpdir, len(importfiles)) - self.createGPXfile(gpxfile, track) - importfiles.append(gpxfile) + if self.valid_input_file(filename): + tracks = self.getTracks(filename) + logging.debug("Found %d tracks in %s" % (len(tracks), filename)) + for track in tracks: #can be multiple tracks + if self.shouldImport(track): + gpxfile = "%s/garminhrfile%d.gpx" % (self.tmpdir, len(importfiles)) + self.createGPXfile(gpxfile, track) + importfiles.append(gpxfile) + logging.debug("Importing %s of %s tracks" % (len(importfiles), len(tracks)) ) + else: + logging.debug("Invalid input file %s" % (filename)) return importfiles + def valid_input_file(self, filename): + """ Function to validate input file if requested""" + if not self.validate: #not asked to validate + return True + else: #Validate TCXv1, note are validating against gpsbabels 'broken' result... + xslfile = os.path.realpath(self.parent.parent.data_path)+ "/schemas/GarminTrainingCenterDatabase_v1-gpsbabel.xsd" + from lib.xmlValidation import xmlValidator + validator = xmlValidator() + return validator.validateXSL(filename, xslfile) + def shouldImport(self, track): """ Function determines whether a track should be imported or not Currently using time only @@ -68,9 +83,10 @@ time = timeElement.text #comparing date and start time (sport may have been changed in DB after import) if self.parent.parent.ddbb.select("records","*","date_time_utc=\"%s\"" % (time)): + logging.debug("Not importing track for time %s" % (time)) + return False + else: return True - else: - return False def getTracks(self, filename): """ Function to return all the tracks in a Garmin Training Center v1 file Added: pytrainer/branches/plugins-v2/pytrainer/lib/xmlValidation.py =================================================================== --- pytrainer/branches/plugins-v2/pytrainer/lib/xmlValidation.py (rev 0) +++ pytrainer/branches/plugins-v2/pytrainer/lib/xmlValidation.py 2009-09-25 11:45:17 UTC (rev 361) @@ -0,0 +1,38 @@ +# -*- coding: iso-8859-1 -*- + +#Copyright (C) + +#This program is free software; you can redistribute it and/or +#modify it under the terms of the GNU General Public License +#as published by the Free Software Foundation; either version 2 +#of the License, or (at your option) any later version. + +#This program is distributed in the hope that it will be useful, +#but WITHOUT ANY WARRANTY; without even the implied warranty of +#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +#GNU General Public License for more details. + +#You should have received a copy of the GNU General Public License +#along with this program; if not, write to the Free Software +#Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +import logging +from lxml import etree + +class xmlValidator(): + def validateXSL(self, filename, xslfile): + try: + doc = etree.parse(filename) + xsl_doc = etree.parse(xslfile) + xsl = etree.XMLSchema(xsl_doc) + except: + logging.debug("Error attempting to parse %s or %s" % (filename, xslfile)) + return False + if xsl.validate(doc): + logging.debug("%s validates against %s" % (filename, xslfile)) + #print "%s validates against %s" % (filename, xslfile) + return True + else: + logging.debug("%s did not validate against %s" % (filename, xslfile)) + #print "%s did not validate against %s" % (filename, xslfile) + return False Modified: pytrainer/branches/plugins-v2/pytrainer/main.py =================================================================== --- pytrainer/branches/plugins-v2/pytrainer/main.py 2009-09-25 10:22:03 UTC (rev 360) +++ pytrainer/branches/plugins-v2/pytrainer/main.py 2009-09-25 11:45:17 UTC (rev 361) @@ -94,6 +94,7 @@ self.profile = Profile(self.data_path,self) #self.profile.setVersion("0.0") self.profile.isProfileConfigured() + self.log_level = log_level logging.debug('checking configuration...') self.conf = checkConf() Modified: pytrainer/branches/plugins-v2/pytrainer/plugins.py =================================================================== --- pytrainer/branches/plugins-v2/pytrainer/plugins.py 2009-09-25 10:22:03 UTC (rev 360) +++ pytrainer/branches/plugins-v2/pytrainer/plugins.py 2009-09-25 11:45:17 UTC (rev 361) @@ -60,7 +60,12 @@ module = __import__(plugin_filename) pluginMain = getattr(module, plugin_classname) logging.debug('<<') - return pluginMain(self) + #Only validate files if in Debug mode + if self.parent.log_level == logging.DEBUG: + validate_inputfiles=True + else: + validate_inputfiles=False + return pluginMain(self, validate_inputfiles) Added: pytrainer/branches/plugins-v2/schemas/Cluetrust_gpxdata10.xsd =================================================================== --- pytrainer/branches/plugins-v2/schemas/Cluetrust_gpxdata10.xsd (rev 0) +++ pytrainer/branches/plugins-v2/schemas/Cluetrust_gpxdata10.xsd 2009-09-25 11:45:17 UTC (rev 361) @@ -0,0 +1,234 @@ +<?xml version = "1.0" encoding = "UTF-8"?> +<!--Generated by Turbo XML 2.4.1.100. Conforms to w3c http://www.w3.org/2001/XMLSchema--> +<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns="http://www.cluetrust.com/XML/GPXDATA/1/0" xmlns:gpx="http://www.topografix.com/GPX/1/1" + targetNamespace="http://www.cluetrust.com/XML/GPXDATA/1/0" elementFormDefault="qualified"> + <xsd:annotation> + <xsd:documentation> + The GPXData schema is an mix-in schema for use with the GPX 1.1 schema from Topografix. It was designed with the intent of + expanding GPX (using the existing mechanisms) to contain additional content from GPS receivers commonly used for sporting and + geocaching activities. + </xsd:documentation> + </xsd:annotation> + <xsd:import namespace="http://www.topografix.com/GPX/1/1" + schemaLocation="http://www.topografix.com/GPX/1/1/gpx.xsd"/> + + <xsd:element name="hr" type="xsd:nonNegativeInteger"> + <xsd:annotation> + <xsd:documentation> + HR represents the heart rate in beats per minute. + </xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="cadence" type="xsd:nonNegativeInteger"> + <xsd:annotation> + <xsd:documentation> + Cadence represents the cadence in revolutions per minute. + </xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="temp" type="xsd:decimal"> + <xsd:annotation> + <xsd:documentation> + Temp represents the temperature in degrees celcius + </xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="distance" type="distanceType"> + <xsd:annotation><xsd:documentation>Distance in meters as measured by GPS or wheel sensor</xsd:documentation></xsd:annotation> + </xsd:element> + <xsd:element name="sensor" type="sensorType"> + <xsd:annotation><xsd:documentation>Set if there is a sensor present</xsd:documentation></xsd:annotation> + </xsd:element> + <xsd:element name="run" type="runType"> + <xsd:annotation><xsd:documentation>On devices that have the concept of a run, the run encapsulates laps and provides overall summary information</xsd:documentation></xsd:annotation> + </xsd:element> + <xsd:element name="dataPt" type="dataPointType"> + <xsd:annotation><xsd:documentation>Added if there is data available that doesn't have position information</xsd:documentation></xsd:annotation> + </xsd:element> + <xsd:element name="lap" type="lapType"> + <xsd:annotation> + <xsd:documentation> + Lap is used to contain information about an individual lap of activity. + Depending upon the device, this may contain a variety of additional information. + Depending upon the device, this may be contained within a run or course. + </xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:element name="course" type="courseType"> + <xsd:annotation> + <xsd:documentation> + Course is used to contain additional information about a course downloaded to the GPS as a track. + Depending on the device, this may be uploaded as part of the data or left empty. + Always appears in a track. + </xsd:documentation> + </xsd:annotation> + </xsd:element> + <xsd:complexType name="dataPointType"> + <xsd:annotation> + <xsd:documentation> + dataPt is used to store information about non-geographic data point. This is useful when HR or other + data is present, but no latitude or longitude data is. + </xsd:documentation> + </xsd:annotation> + <xsd:sequence> + <xsd:element name="time" type="xsd:dateTime"/> + <xsd:element name="ele" type="xsd:decimal" minOccurs="0" maxOccurs="1"/> + <xsd:element ref="hr" minOccurs="0" maxOccurs="1"/> + <xsd:element ref="cadence" minOccurs="0" maxOccurs="1"/> + <xsd:element ref="temp" minOccurs="0" maxOccurs="1"/> + <xsd:element ref="distance" minOccurs="0" maxOccurs="1"/> + <xsd:element ref="sensor" minOccurs="0" maxOccurs="1"/> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="runType"> + <xsd:sequence> + <xsd:element name="sport" type="sportType" minOccurs="0" maxOccurs="1"> + <xsd:annotation><xsd:documentation>The type of sport being participated in</xsd:documentation></xsd:annotation> + </xsd:element> + <xsd:element name="programType" type="xsd:anySimpleType" minOccurs="0" maxOccurs="1"> + <xsd:annotation><xsd:documentation>The type of program being executed</xsd:documentation></xsd:annotation> + </xsd:element> + <xsd:element name="laps" minOccurs="0" maxOccurs="1"> + <xsd:annotation><xsd:documentation>Group of laps that make up the run</xsd:documentation></xsd:annotation> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="lap" type="lapType" minOccurs="0" maxOccurs="unbounded"/> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="courseType"> + <xsd:sequence> + <xsd:element name="index" type="xsd:int" minOccurs="0" maxOccurs="1"> + <xsd:annotation><xsd:documentation>Index of the course in the GPS.</xsd:documentation></xsd:annotation> + </xsd:element> + <xsd:element name="laps" minOccurs="0" maxOccurs="1"> + <xsd:annotation><xsd:documentation>Group of laps that make up the course</xsd:documentation></xsd:annotation> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="lap" type="lapType" minOccurs="0" maxOccurs="unbounded"/> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="lapType"> + <xsd:sequence> + <xsd:element name="index" type="xsd:int" minOccurs="0" maxOccurs="1"> + <xsd:annotation><xsd:documentation>The index of the lap in the internal list.</xsd:documentation></xsd:annotation> + </xsd:element> + <xsd:element name="startPoint" type="locationType" minOccurs="0" maxOccurs="1"> + <xsd:annotation><xsd:documentation>The starting point of the lap in Lat/Long</xsd:documentation></xsd:annotation> + </xsd:element> + <xsd:element name="endPoint" type="locationType" minOccurs="0" maxOccurs="1"> + <xsd:annotation><xsd:documentation>The ending point of the lap in Lat/Long</xsd:documentation></xsd:annotation> + </xsd:element> + <xsd:element name="startTime" type="xsd:dateTime" minOccurs="0" maxOccurs="1"> + <xsd:annotation><xsd:documentation>The starting time of the lap</xsd:documentation></xsd:annotation> + </xsd:element> + <xsd:element name="elapsedTime" type="xsd:float" minOccurs="0" maxOccurs="1"> + <xsd:annotation><xsd:documentation>The total elapsed time of the lap in seconds</xsd:documentation></xsd:annotation> + </xsd:element> + <xsd:element name="calories" type="xsd:nonNegativeInteger" minOccurs="0" maxOccurs="1"> + <xsd:annotation><xsd:documentation>The number of calories burned during the lap</xsd:documentation></xsd:annotation> + </xsd:element> + <xsd:element name="distance" type="xsd:float" minOccurs="0" maxOccurs="1"> + <xsd:annotation><xsd:documentation>Distance (in m) covered during the lap</xsd:documentation></xsd:annotation> + </xsd:element> + <xsd:element name="trackReference" type="trackReferenceType" minOccurs="0" maxOccurs="1"> + <xsd:annotation><xsd:documentation>Reference information for the track which corresponds to this lap</xsd:documentation></xsd:annotation> + </xsd:element> + <xsd:element name="summary" type="summaryType" minOccurs="0" maxOccurs="unbounded"> + <xsd:annotation><xsd:documentation>Performance summary elements summarizing different performance measurements, such as cadence, hr, etc.</xsd:documentation></xsd:annotation> + </xsd:element> + <xsd:element name="trigger" type="triggerType" minOccurs="0" maxOccurs="1"> + <xsd:annotation><xsd:documentation>The trigger of the lap. On some devices, the lap may be manual or automatic based on attributes known by the device.</xsd:documentation></xsd:annotation> + </xsd:element> + <xsd:element name="intensity" type="intensityKind" minOccurs="0" maxOccurs="1"> + <xsd:annotation><xsd:documentation>The intensity of the lap (whether resting or active)</xsd:documentation></xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:complexType> + <xsd:simpleType name="sportType"> + <xsd:restriction base="xsd:token"> + <xsd:enumeration value="bike"/> + <xsd:enumeration value="run"/> + <xsd:enumeration value="other"/> + </xsd:restriction> + </xsd:simpleType> + <xsd:complexType name="distanceType"> + <xsd:simpleContent> + <xsd:extension base="xsd:decimal"> + <xsd:attribute name="sensor" use="optional" type="sensorKind"></xsd:attribute> + </xsd:extension> + </xsd:simpleContent> + </xsd:complexType> + <xsd:complexType name="sensorType"> + <xsd:attribute name="kind" use="required" type="sensorKind"/> + </xsd:complexType> + <xsd:simpleType name="sensorKind"> + <xsd:restriction base="xsd:token"> + <xsd:enumeration value="wheel"/> + <xsd:enumeration value="pedometer"/> + </xsd:restriction> + </xsd:simpleType> + <xsd:complexType name="summaryType"> + <xsd:simpleContent> + <xsd:extension base="xsd:decimal"> + <xsd:attribute name="name" use="required" type="xsd:string"/> + <xsd:attribute name="kind" use="required" type="summaryKind"/> + </xsd:extension> + </xsd:simpleContent> + </xsd:complexType> + <xsd:simpleType name="summaryKind"> + <xsd:restriction base="xsd:token"> + <xsd:enumeration value="max"/> + <xsd:enumeration value="min"/> + <xsd:enumeration value="avg"/> + </xsd:restriction> + </xsd:simpleType> + <xsd:complexType name="triggerType"> + <xsd:simpleContent> + <xsd:extension base="xsd:anySimpleType"> + <xsd:attribute name="kind" use="required" type="triggerKind"/> + </xsd:extension> + </xsd:simpleContent> + </xsd:complexType> + <xsd:simpleType name="triggerKind"> + <xsd:restriction base="xsd:token"> + <xsd:enumeration value="manual"/> + <xsd:enumeration value="time"/> + <xsd:enumeration value="distance"/> + <xsd:enumeration value="location"/> + <xsd:enumeration value="hr"/> + </xsd:restriction> + </xsd:simpleType> + <xsd:simpleType name="intensityKind"> + <xsd:restriction base="xsd:token"> + <xsd:enumeration value="rest"/> + <xsd:enumeration value="active"/> + </xsd:restriction> + </xsd:simpleType> + <xsd:complexType name="locationType"> + <xsd:attribute name="lat" use="required" type="gpx:latitudeType"/> + <xsd:attribute name="lon" use="required" type="gpx:longitudeType"/> + </xsd:complexType> + <xsd:complexType name="trackReferenceType"> + <xsd:sequence> + <xsd:element name="startPoint" type="xsd:nonNegativeInteger" minOccurs="0"> + <xsd:annotation><xsd:documentation>Index into the referenced track of the point that this lap starts on</xsd:documentation></xsd:annotation> + </xsd:element> + <xsd:element name="endPoint" type="xsd:nonNegativeInteger" minOccurs="0"> + <xsd:annotation><xsd:documentation>Index into the referenced track of the point that this lap starts on</xsd:documentation></xsd:annotation> + </xsd:element> + </xsd:sequence> + <xsd:attribute name="trackNumber" type="xsd:nonNegativeInteger" use="optional"> + <xsd:annotation><xsd:documentation>Reference by number to the track (matches number)</xsd:documentation></xsd:annotation> + </xsd:attribute> + <xsd:attribute name="trackName" type="xsd:string" use="optional"> + <xsd:annotation><xsd:documentation>Reference by name to the track (matches name)</xsd:documentation></xsd:annotation> + </xsd:attribute> + </xsd:complexType> +</xsd:schema> Added: pytrainer/branches/plugins-v2/schemas/GarminTrainingCenterDatabase_v1-gpsbabel.xsd =================================================================== --- pytrainer/branches/plugins-v2/schemas/GarminTrainingCenterDatabase_v1-gpsbabel.xsd (rev 0) +++ pytrainer/branches/plugins-v2/schemas/GarminTrainingCenterDatabase_v1-gpsbabel.xsd 2009-09-25 11:45:17 UTC (rev 361) @@ -0,0 +1,656 @@ +<?xml version="1.0"?> +<xsd:schema xmlns="http://www.garmin.com/xmlschemas/TrainingCenterDatabase/v1" xmlns:xsd="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.garmin.com/xmlschemas/TrainingCenterDatabase/v1" xmlns:tc1="http://www.garmin.com/xmlschemas/TrainingCenterDatabase/v1" + elementFormDefault="qualified"> + <xsd:annotation> + <xsd:documentation> + This schema defines the Garmin Training Center file format. + </xsd:documentation> + </xsd:annotation> + <xsd:element name="TrainingCenterDatabase" type="TrainingCenterDatabase_t"/> + <xsd:complexType name="TrainingCenterDatabase_t"> + <xsd:sequence> + <xsd:element name="History" type="History_t" minOccurs="0"/> + <xsd:element name="Workouts" type="Workouts_t" minOccurs="0"> + <xsd:annotation> + <xsd:documentation> + The workouts stored in a workout file should have unique names. + </xsd:documentation> + </xsd:annotation> + <xsd:unique name="WorkoutNameMustBeUnique"> + <xsd:selector xpath="tc1:Workout"/> + <xsd:field xpath="tc1:Name"/> + </xsd:unique> + </xsd:element> + <xsd:element name="Courses" type="Courses_t" minOccurs="0"> + <xsd:annotation> + <xsd:documentation> + The courses stored in a course file should have unique names. + </xsd:documentation> + </xsd:annotation> + <xsd:unique name="CourseNameMustBeUnique"> + <xsd:selector xpath="tc1:Course"/> + <xsd:field xpath="tc1:Name"/> + </xsd:unique> + </xsd:element> + <xsd:element name="Extensions" type="Extensions_t" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>You can extend Training Center by adding your own elements from another schema here.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="History_t"> + <xsd:sequence> + <xsd:element name="Running" type="HistoryFolder_t"/> + <xsd:element name="Biking" type="HistoryFolder_t"/> + <xsd:element name="Other" type="HistoryFolder_t"/> + <xsd:element name="MultiSport" type="MultiSportFolder_t"/> + <xsd:element name="Extensions" type="Extensions_t" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>You can extend Training Center by adding your own elements from another schema here.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="HistoryFolder_t"> + <xsd:sequence> + <xsd:element name="Folder" type="HistoryFolder_t" minOccurs="0" maxOccurs="unbounded"/> + <xsd:element name="Run" type="Run_t" minOccurs="0" maxOccurs="unbounded"/> + <xsd:element name="Week" type="Week_t" minOccurs="0" maxOccurs="unbounded"/> + <xsd:element name="Notes" type="xsd:string" minOccurs="0"/> + <xsd:element name="Extensions" type="Extensions_t" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>You can extend Training Center by adding your own elements from another schema here.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + <xsd:attribute name="Name" type="xsd:string" /> + </xsd:complexType> + <xsd:complexType name="MultiSportFolder_t"> + <xsd:sequence> + <xsd:element name="Folder" type="MultiSportFolder_t" minOccurs="0" maxOccurs="unbounded"/> + <xsd:element name="MultiSportSession" type="MultiSportSession_t" minOccurs="0" maxOccurs="unbounded"/> + <xsd:element name="Week" type="Week_t" minOccurs="0" maxOccurs="unbounded"/> + <xsd:element name="Notes" type="xsd:string" minOccurs="0"/> + <xsd:element name="Extensions" type="Extensions_t" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>You can extend Training Center by adding your own elements from another schema here.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + <xsd:attribute name="Name" type="xsd:string"/> + </xsd:complexType> + <xsd:complexType name="Week_t"> + <xsd:sequence> + <xsd:annotation> + <xsd:documentation> + The week is written out only if the notes are present. + </xsd:documentation> + </xsd:annotation> + <xsd:element name="Notes" type="xsd:string" minOccurs="0"/> + </xsd:sequence> + <xsd:attribute name="StartDay" type="xsd:date" use="required"/> + </xsd:complexType> + <xsd:complexType name="MultiSportSession_t"> + <xsd:sequence> + <xsd:element name="FirstSport" type="FirstSport_t"/> + <xsd:element name="NextSport" type="NextSport_t" minOccurs="0" maxOccurs="unbounded"/> + <xsd:element name="Notes" type="xsd:string" minOccurs="0"/> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="FirstSport_t"> + <xsd:sequence> + <xsd:element name="Run" type="Run_t"/> + </xsd:sequence> + <xsd:attribute name="Sport" type="Sport_t" use="required"/> + </xsd:complexType> + <xsd:complexType name="NextSport_t"> + <xsd:sequence> + <xsd:annotation> + <xsd:documentation> + Each sport contains an optional transition and a run. + </xsd:documentation> + </xsd:annotation> + <xsd:element name="Transition" type="ActivityLap_t" minOccurs="0"/> + <xsd:element name="Run" type="Run_t"/> + </xsd:sequence> + <xsd:attribute name="Sport" type="Sport_t" use="required"/> + </xsd:complexType> + <xsd:simpleType name="Sport_t"> + <xsd:restriction base="xsd:token"> + <xsd:enumeration value="Running"/> + <xsd:enumeration value="Biking"/> + <xsd:enumeration value="Other"/> + </xsd:restriction> + </xsd:simpleType> + <xsd:complexType name="Run_t"> + <xsd:sequence> + <xsd:element name="Lap" type="ActivityLap_t" maxOccurs="unbounded"/> + <xsd:element name="Notes" type="xsd:string" minOccurs="0"/> + <xsd:element name="Training" type="Training_t" minOccurs="0"/> + <xsd:element name="Extensions" type="Extensions_t" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>You can extend Training Center by adding your own elements from another schema here.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="Training_t"> + <xsd:sequence> + <xsd:element name="QuickWorkoutResults" type="QuickWorkout_t" minOccurs="0"/> + <xsd:element name="Plan" type="Plan_t" minOccurs="0"/> + </xsd:sequence> + <xsd:attribute name="VirtualPartner" type="xsd:boolean" use="required"/> + </xsd:complexType> + <xsd:complexType name="QuickWorkout_t"> + <xsd:sequence> + <xsd:element name="TotalTimeSeconds" type="xsd:double"/> + <xsd:element name="DistanceMeters" type="xsd:double"/> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="Plan_t"> + <xsd:sequence> + <xsd:element name="Name" type="RestrictedToken_t" minOccurs="0"/> + <xsd:element name="Extensions" type="Extensions_t" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>You can extend Training Center by adding your own elements from another schema here.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + <xsd:attribute name="Type" type="TrainingType_t" use="required"/> + <xsd:attribute name="IntervalWorkout" type="xsd:boolean" use="required"/> + </xsd:complexType> + <xsd:simpleType name="TrainingType_t"> + <xsd:restriction base="xsd:token"> + <xsd:enumeration value="Workout"/> + <xsd:enumeration value="Course"/> + </xsd:restriction> + </xsd:simpleType> + <xsd:complexType name="ActivityLap_t"> + <xsd:sequence> + <xsd:element name="TotalTimeSeconds" type="xsd:double"/> + <xsd:element name="DistanceMeters" type="xsd:double"/> + <xsd:element name="MaximumSpeed" type="xsd:double" minOccurs="0"/> + <xsd:element name="Calories" type="xsd:unsignedShort"/> + <xsd:element name="AverageHeartRateBpm" type="xsd:unsignedByte" minOccurs="0"/> + <xsd:element name="MaximumHeartRateBpm" type="xsd:unsignedByte" minOccurs="0"/> + <xsd:element name="Intensity" type="Intensity_t"/> + <xsd:element name="Cadence" type="xsd:unsignedByte" minOccurs="0"/> + <xsd:element name="TriggerMethod" type="TriggerMethod_t"/> + <xsd:element name="Track" type="Track_t" minOccurs="0" maxOccurs="unbounded"/> + <xsd:element name="Notes" type="xsd:string" minOccurs="0"/> + <xsd:element name="Extensions" type="Extensions_t" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>You can extend Training Center by adding your own elements from another schema here.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + <xsd:attribute name="StartTime" type="xsd:dateTime" use="required"/> + </xsd:complexType> + <xsd:simpleType name="TriggerMethod_t"> + <xsd:restriction base="xsd:token"> + <xsd:enumeration value="Manual"/> + <xsd:enumeration value="Distance"/> + <xsd:enumeration value="Location"/> + <xsd:enumeration value="Time"/> + <xsd:enumeration value="HeartRate"/> + </xsd:restriction> + </xsd:simpleType> + <xsd:complexType name="Track_t"> + <xsd:sequence> + <xsd:element name="Trackpoint" type="Trackpoint_t" maxOccurs="unbounded"/> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="Trackpoint_t"> + <xsd:sequence> + <xsd:element name="Time" type="xsd:dateTime"/> + <xsd:element name="Position" type="Position_t" minOccurs="0"/> + <xsd:element name="AltitudeMeters" type="xsd:double" minOccurs="0"/> + <xsd:element name="DistanceMeters" type="xsd:double" minOccurs="0"/> + <xsd:element name="HeartRateBpm" type="xsd:unsignedByte" minOccurs="0"/> + <xsd:element name="Cadence" type="xsd:unsignedByte" minOccurs="0"/> + <xsd:element name="SensorState" type="SensorState_t" minOccurs="0"/> + <xsd:element name="Extensions" type="Extensions_t" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>You can extend Training Center by adding your own elements from another schema here.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="Position_t"> + <xsd:sequence> + <xsd:element name="LatitudeDegrees" type="DegreesLatitude_t"/> + <xsd:element name="LongitudeDegrees" type="DegreesLongitude_t"/> + </xsd:sequence> + </xsd:complexType> + <xsd:simpleType name="DegreesLongitude_t"> + <xsd:annotation> + <xsd:documentation/> + </xsd:annotation> + <xsd:restriction base="xsd:double"> + <xsd:maxExclusive value="180.0"/> + <xsd:minInclusive value="-180.0"/> + </xsd:restriction> + </xsd:simpleType> + <xsd:simpleType name="DegreesLatitude_t"> + <xsd:annotation> + <xsd:documentation/> + </xsd:annotation> + <xsd:restriction base="xsd:double"> + <xsd:maxInclusive value="90.0"/> + <xsd:minInclusive value="-90.0"/> + </xsd:restriction> + </xsd:simpleType> + <xsd:simpleType name="SensorState_t"> + <xsd:restriction base="xsd:token"> + <xsd:enumeration value="Present"/> + <xsd:enumeration value="Absent"/> + </xsd:restriction> + </xsd:simpleType> + <xsd:complexType name="Workouts_t"> + <xsd:sequence> + <xsd:element name="Running" type="WorkoutFolder_t"> + <xsd:unique name="RunningSubFolderNamesMustBeUnique"> + <xsd:selector xpath="tc1:Folder"/> + <xsd:field xpath="@Name"/> + </xsd:unique> + </xsd:element> + <xsd:element name="Biking" type="WorkoutFolder_t"> + <xsd:unique name="BikingSubFolderNamesMustBeUnique"> + <xsd:selector xpath="tc1:Folder"/> + <xsd:field xpath="@Name"/> + </xsd:unique> + </xsd:element> + <xsd:element name="Other" type="WorkoutFolder_t"> + <xsd:unique name="OtherSubFolderNamesMustBeUnique"> + <xsd:selector xpath="tc1:Folder"/> + <xsd:field xpath="@Name"/> + </xsd:unique> + </xsd:element> + <xsd:element name="Extensions" type="Extensions_t" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>You can extend Training Center by adding your own elements from another schema here.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="WorkoutFolder_t"> + <xsd:sequence> + <xsd:element name="Folder" type="WorkoutFolder_t" minOccurs="0" maxOccurs="unbounded"> + <xsd:unique name="SubFolderNamesMustBeUnique"> + <xsd:selector xpath="tc1:Folder"/> + <xsd:field xpath="@Name"/> + </xsd:unique> + </xsd:element> + <xsd:element name="Workout" type="Workout_t" minOccurs="0" maxOccurs="unbounded"> + <xsd:annotation> + <xsd:documentation> + The StepId should be unique within a workout and should not + exceed 20. This restricts the number of steps in a workout to 20. + </xsd:documentation> + </xsd:annotation> + <xsd:unique name="StepIdMustBeUnique"> + <xsd:selector xpath=".//*"/> + <xsd:field xpath="tc1:StepId"/> + </xsd:unique> + </xsd:element> + <xsd:element name="Extensions" type="Extensions_t" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>You can extend Training Center by adding your own elements from another schema here.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + <xsd:attribute name="Name" type="xsd:string" use="required"/> + </xsd:complexType> + <xsd:complexType name="Workout_t"> + <xsd:sequence> + <xsd:element name="Name" type="RestrictedToken_t"/> + <xsd:element name="Step" type="AbstractStep_t" maxOccurs="unbounded"/> + <xsd:element name="ScheduledOn" type="xsd:date" minOccurs="0" maxOccurs="unbounded"/> + <xsd:element name="Notes" type="xsd:string" minOccurs="0"/> + <xsd:element name="Extensions" type="Extensions_t" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>You can extend Training Center by adding your own elements from another schema here.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:complexType> + <xsd:simpleType name="RestrictedToken_t"> + <xsd:restriction base="xsd:token"> + <xsd:minLength value="1"/> + <xsd:maxLength value="15"/> + </xsd:restriction> + </xsd:simpleType> + <xsd:complexType name="AbstractStep_t" abstract="true"> + <xsd:sequence> + <xsd:element name="StepId" type="StepId_t"/> + </xsd:sequence> + </xsd:complexType> + <xsd:simpleType name="StepId_t"> + <xsd:restriction base="xsd:positiveInteger"> + <xsd:maxInclusive value="20"/> + </xsd:restriction> + </xsd:simpleType> + <xsd:complexType name="Repeat_t"> + <xsd:complexContent> + <xsd:extension base="AbstractStep_t"> + <xsd:sequence> + <xsd:element name="Repetitions" type="Repetitions_t"/> + <xsd:element name="Child" type="AbstractStep_t" maxOccurs="unbounded"/> + </xsd:sequence> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + <xsd:simpleType name="Repetitions_t"> + <xsd:restriction base="xsd:positiveInteger"> + <xsd:minInclusive value="2"/> + <xsd:maxInclusive value="99"/> + </xsd:restriction> + </xsd:simpleType> + <xsd:complexType name="Step_t"> + <xsd:complexContent> + <xsd:extension base="AbstractStep_t"> + <xsd:sequence> + <xsd:element name="Name" type="RestrictedToken_t" minOccurs="0"/> + <xsd:element name="Duration" type="Duration_t"/> + <xsd:element name="Intensity" type="Intensity_t"/> + <xsd:element name="Target" type="Target_t"/> + </xsd:sequence> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + <xsd:complexType name="Duration_t" abstract="true"/> + <xsd:simpleType name="Intensity_t"> + <xsd:restriction base="xsd:token"> + <xsd:enumeration value="Active"/> + <xsd:enumeration value="Resting"/> + </xsd:restriction> + </xsd:simpleType> + <xsd:complexType name="Target_t" abstract="true"/> + <xsd:complexType name="Time_t"> + <xsd:complexContent> + <xsd:extension base="Duration_t"> + <xsd:sequence> + <xsd:element name="Seconds" type="xsd:unsignedShort"/> + </xsd:sequence> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + <xsd:complexType name="Distance_t"> + <xsd:complexContent> + <xsd:extension base="Duration_t"> + <xsd:sequence> + <xsd:element name="Meters" type="xsd:unsignedShort"/> + </xsd:sequence> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + <xsd:complexType name="HeartRateAbove_t"> + <xsd:complexContent> + <xsd:extension base="Duration_t"> + <xsd:sequence> + <xsd:element name="HeartRate" type="HeartRateValue_t"/> + </xsd:sequence> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + <xsd:complexType name="HeartRateValue_t" abstract="true"/> + <xsd:complexType name="HeartRateBelow_t"> + <xsd:complexContent> + <xsd:extension base="Duration_t"> + <xsd:sequence> + <xsd:element name="HeartRate" type="HeartRateValue_t"/> + </xsd:sequence> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + <xsd:complexType name="CaloriesBurned_t"> + <xsd:complexContent> + <xsd:extension base="Duration_t"> + <xsd:sequence> + <xsd:element name="Calories" type="xsd:unsignedShort"/> + </xsd:sequence> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + <xsd:complexType name="UserInitiated_t"> + <xsd:complexContent> + <xsd:extension base="Duration_t"/> + </xsd:complexContent> + </xsd:complexType> + <xsd:complexType name="Speed_t"> + <xsd:complexContent> + <xsd:extension base="Target_t"> + <xsd:sequence> + <xsd:element name="SpeedZone" type="Zone_t"/> + </xsd:sequence> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + <xsd:complexType name="HeartRate_t"> + <xsd:complexContent> + <xsd:extension base="Target_t"> + <xsd:sequence> + <xsd:element name="HeartRateZone" type="Zone_t"/> + </xsd:sequence> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + <xsd:complexType name="Cadence_t"> + <xsd:complexContent> + <xsd:extension base="Target_t"> + <xsd:sequence> + <xsd:element name="Low" type="xsd:double"/> + <xsd:element name="High" type="xsd:double"/> + </xsd:sequence> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + <xsd:complexType name="None_t"> + <xsd:complexContent> + <xsd:extension base="Target_t"/> + </xsd:complexContent> + </xsd:complexType> + <xsd:complexType name="Zone_t" abstract="true"/> + <xsd:complexType name="PredefinedSpeedZone_t"> + <xsd:complexContent> + <xsd:extension base="Zone_t"> + <xsd:sequence> + <xsd:element name="Number" type="SpeedZoneNumbers_t"/> + </xsd:sequence> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + <xsd:simpleType name="SpeedZoneNumbers_t"> + <xsd:restriction base="xsd:positiveInteger"> + <xsd:maxInclusive value="10"/> + </xsd:restriction> + </xsd:simpleType> + <xsd:complexType name="CustomSpeedZone_t"> + <xsd:complexContent> + <xsd:extension base="Zone_t"> + <xsd:sequence> + <xsd:element name="ViewAs" type="SpeedType_t"/> + <xsd:element name="LowInMetersPerSecond" type="SpeedInMetersPerSecond_t"/> + <xsd:element name="HighInMetersPerSecond" type="SpeedInMetersPerSecond_t"/> + </xsd:sequence> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + <xsd:simpleType name="SpeedInMetersPerSecond_t"> + <xsd:restriction base="xsd:double"> + <xsd:minExclusive value="0"/> + </xsd:restriction> + </xsd:simpleType> + <xsd:simpleType name="SpeedType_t"> + <xsd:restriction base="xsd:token"> + <xsd:enumeration value="Pace"/> + <xsd:enumeration value="Speed"/> + </xsd:restriction> + </xsd:simpleType> + <xsd:complexType name="PredefinedHeartRateZone_t"> + <xsd:complexContent> + <xsd:extension base="Zone_t"> + <xsd:sequence> + <xsd:element name="Number" type="HeartRateZoneNumbers_t"/> + </xsd:sequence> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + <xsd:simpleType name="HeartRateZoneNumbers_t"> + <xsd:restriction base="xsd:positiveInteger"> + <xsd:maxInclusive value="5"/> + </xsd:restriction> + </xsd:simpleType> + <xsd:complexType name="CustomHeartRateZone_t"> + <xsd:complexContent> + <xsd:extension base="Zone_t"> + <xsd:sequence> + <xsd:element name="Low" type="HeartRateValue_t"/> + <xsd:element name="High" type="HeartRateValue_t"/> + </xsd:sequence> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + <xsd:complexType name="HeartRateInBeatsPerMinute_t"> + <xsd:complexContent> + <xsd:extension base="HeartRateValue_t"> + <xsd:sequence> + <xsd:element name="Value" type="xsd:unsignedByte"/> + </xsd:sequence> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + <xsd:complexType name="HeartRateAsPercentOfMax_t"> + <xsd:complexContent> + <xsd:extension base="HeartRateValue_t"> + <xsd:sequence> + <xsd:element name="Value" type="PercentOfMax_t"/> + </xsd:sequence> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + <xsd:simpleType name="PercentOfMax_t"> + <xsd:restriction base="xsd:unsignedByte"> + <xsd:minInclusive value="0"/> + <xsd:maxInclusive value="100"/> + </xsd:restriction> + </xsd:simpleType> + <xsd:complexType name="Courses_t"> + <xsd:sequence> + <xsd:element name="CourseFolder" type="CourseFolder_t"> + <xsd:unique name="CourseSubFolderNamesMustBeUnique"> + <xsd:selector xpath="tc1:CourseFolder"/> + <xsd:field xpath="@Name"/> + </xsd:unique> + </xsd:element> + <xsd:element name="Extensions" type="Extensions_t" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>You can extend Training Center by adding your own elements from another schema here.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="CourseFolder_t"> + <xsd:sequence> + <xsd:element name="Folder" type="CourseFolder_t" minOccurs="0" maxOccurs="unbounded"/> + <xsd:element name="Course" type="Course_t" minOccurs="0" maxOccurs="unbounded"> + <xsd:unique name="CourseNamesMustBeUnique"> + <xsd:selector xpath="tc1:Course"/> + <xsd:field xpath="tc1:Name"/> + </xsd:unique> + </xsd:element> + <xsd:element name="Notes" type="xsd:string" minOccurs="0"/> + <xsd:element name="Extensions" type="Extensions_t" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>You can extend Training Center by adding your own elements from another schema here.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + <xsd:attribute name="Name" type="xsd:string" use="required"/> + </xsd:complexType> + <xsd:complexType name="Course_t"> + <xsd:sequence> + <xsd:element name="Name" type="RestrictedToken_t"/> + <xsd:element name="Lap" type="CourseLap_t" minOccurs="0" maxOccurs="unbounded"/> + <xsd:element name="Track" type="Track_t" minOccurs="0" maxOccurs="unbounded"/> + <xsd:element name="Notes" type="xsd:string" minOccurs="0"/> + <xsd:element name="CoursePoint" type="CoursePoint_t" minOccurs="0" maxOccurs="unbounded"/> + <xsd:element name="Extensions" type="Extensions_t" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>You can extend Training Center by adding your own elements from another schema here.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="CourseLap_t"> + <xsd:sequence> + <xsd:element name="TotalTimeSeconds" type="xsd:double"/> + <xsd:element name="DistanceMeters" type="xsd:double"/> + <xsd:element name="BeginPosition" type="Position_t" minOccurs="0"/> + <xsd:element name="BeginAltitudeMeters" type="xsd:double" minOccurs="0"/> + <xsd:element name="EndPosition" type="Position_t" minOccurs="0"/> + <xsd:element name="EndAltitudeMeters" type="xsd:double" minOccurs="0"/> + <xsd:element name="AverageHeartRateBpm" type="xsd:unsignedByte" minOccurs="0"/> + <xsd:element name="MaximumHeartRateBpm" type="xsd:unsignedByte" minOccurs="0"/> + <xsd:element name="Intensity" type="Intensity_t"/> + <xsd:element name="Cadence" type="xsd:unsignedByte" minOccurs="0"/> + <xsd:element name="Extensions" type="Extensions_t" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>You can extend Training Center by adding your own elements from another schema here.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="CoursePoint_t"> + <xsd:sequence> + <xsd:element name="Name" type="CoursePointName_t"/> + <xsd:element name="Time" type="xsd:dateTime"/> + <xsd:element name="Position" type="Position_t"/> + <xsd:element name="AltitudeMeters" type="xsd:double" minOccurs="0"/> + <xsd:element name="PointType" type="CoursePointType_t"/> + <xsd:element name="Notes" type="xsd:string" minOccurs="0"/> + <xsd:element name="Extensions" type="Extensions_t" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>You can extend Training Center by adding your own elements from another schema here.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:complexType> + <xsd:simpleType name="CoursePointName_t"> + <xsd:restriction base="xsd:token"> + <xsd:minLength value="1"/> + <xsd:maxLength value="10"/> + </xsd:restriction> + </xsd:simpleType> + <xsd:simpleType name="CoursePointType_t"> + <xsd:restriction base="xsd:token"> + <xsd:enumeration value="Generic"/> + <xsd:enumeration value="Summit"/> + <xsd:enumeration value="Valley"/> + <xsd:enumeration value="Water"/> + <xsd:enumeration value="Food"/> + <xsd:enumeration value="Danger"/> + <xsd:enumeration value="Left"/> + <xsd:enumeration value="Right"/> + <xsd:enumeration value="Straight"/> + <xsd:enumeration value="First Aid"/> + <xsd:enumeration value="4th Category"/> + <xsd:enumeration value="3rd Category"/> + <xsd:enumeration value="2nd Category"/> + <xsd:enumeration value="1st Category"/> + <xsd:enumeration value="Hors Category"/> + <xsd:enumeration value="Sprint"/> + </xsd:restriction> + </xsd:simpleType> + <xsd:complexType name="Extensions_t"> + <xsd:sequence> + <xsd:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"> + <xsd:annotation> + <xsd:documentation>You can extend Training Center by adding your own elements from another schema here.</xsd:documentation> + </xsd:annotation> + </xsd:any> + </xsd:sequence> + </xsd:complexType> +</xsd:schema> Added: pytrainer/branches/plugins-v2/schemas/GarminTrainingCenterDatabase_v1.xsd =================================================================== --- pytrainer/branches/plugins-v2/schemas/GarminTrainingCenterDatabase_v1.xsd (rev 0) +++ pytrainer/branches/plugins-v2/schemas/GarminTrainingCenterDatabase_v1.xsd 2009-09-25 11:45:17 UTC (rev 361) @@ -0,0 +1,656 @@ +<?xml version="1.0"?> +<xsd:schema xmlns="http://www.garmin.com/xmlschemas/TrainingCenterDatabase/v1" xmlns:xsd="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.garmin.com/xmlschemas/TrainingCenterDatabase/v1" xmlns:tc1="http://www.garmin.com/xmlschemas/TrainingCenterDatabase/v1" + elementFormDefault="qualified"> + <xsd:annotation> + <xsd:documentation> + This schema defines the Garmin Training Center file format. + </xsd:documentation> + </xsd:annotation> + <xsd:element name="TrainingCenterDatabase" type="TrainingCenterDatabase_t"/> + <xsd:complexType name="TrainingCenterDatabase_t"> + <xsd:sequence> + <xsd:element name="History" type="History_t" minOccurs="0"/> + <xsd:element name="Workouts" type="Workouts_t" minOccurs="0"> + <xsd:annotation> + <xsd:documentation> + The workouts stored in a workout file should have unique names. + </xsd:documentation> + </xsd:annotation> + <xsd:unique name="WorkoutNameMustBeUnique"> + <xsd:selector xpath="tc1:Workout"/> + <xsd:field xpath="tc1:Name"/> + </xsd:unique> + </xsd:element> + <xsd:element name="Courses" type="Courses_t" minOccurs="0"> + <xsd:annotation> + <xsd:documentation> + The courses stored in a course file should have unique names. + </xsd:documentation> + </xsd:annotation> + <xsd:unique name="CourseNameMustBeUnique"> + <xsd:selector xpath="tc1:Course"/> + <xsd:field xpath="tc1:Name"/> + </xsd:unique> + </xsd:element> + <xsd:element name="Extensions" type="Extensions_t" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>You can extend Training Center by adding your own elements from another schema here.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="History_t"> + <xsd:sequence> + <xsd:element name="Running" type="HistoryFolder_t"/> + <xsd:element name="Biking" type="HistoryFolder_t"/> + <xsd:element name="Other" type="HistoryFolder_t"/> + <xsd:element name="MultiSport" type="MultiSportFolder_t"/> + <xsd:element name="Extensions" type="Extensions_t" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>You can extend Training Center by adding your own elements from another schema here.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="HistoryFolder_t"> + <xsd:sequence> + <xsd:element name="Folder" type="HistoryFolder_t" minOccurs="0" maxOccurs="unbounded"/> + <xsd:element name="Run" type="Run_t" minOccurs="0" maxOccurs="unbounded"/> + <xsd:element name="Week" type="Week_t" minOccurs="0" maxOccurs="unbounded"/> + <xsd:element name="Notes" type="xsd:string" minOccurs="0"/> + <xsd:element name="Extensions" type="Extensions_t" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>You can extend Training Center by adding your own elements from another schema here.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + <xsd:attribute name="Name" type="xsd:string" use="required"/> + </xsd:complexType> + <xsd:complexType name="MultiSportFolder_t"> + <xsd:sequence> + <xsd:element name="Folder" type="MultiSportFolder_t" minOccurs="0" maxOccurs="unbounded"/> + <xsd:element name="MultiSportSession" type="MultiSportSession_t" minOccurs="0" maxOccurs="unbounded"/> + <xsd:element name="Week" type="Week_t" minOccurs="0" maxOccurs="unbounded"/> + <xsd:element name="Notes" type="xsd:string" minOccurs="0"/> + <xsd:element name="Extensions" type="Extensions_t" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>You can extend Training Center by adding your own elements from another schema here.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + <xsd:attribute name="Name" type="xsd:string" use="required"/> + </xsd:complexType> + <xsd:complexType name="Week_t"> + <xsd:sequence> + <xsd:annotation> + <xsd:documentation> + The week is written out only if the notes are present. + </xsd:documentation> + </xsd:annotation> + <xsd:element name="Notes" type="xsd:string" minOccurs="0"/> + </xsd:sequence> + <xsd:attribute name="StartDay" type="xsd:date" use="required"/> + </xsd:complexType> + <xsd:complexType name="MultiSportSession_t"> + <xsd:sequence> + <xsd:element name="FirstSport" type="FirstSport_t"/> + <xsd:element name="NextSport" type="NextSport_t" minOccurs="0" maxOccurs="unbounded"/> + <xsd:element name="Notes" type="xsd:string" minOccurs="0"/> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="FirstSport_t"> + <xsd:sequence> + <xsd:element name="Run" type="Run_t"/> + </xsd:sequence> + <xsd:attribute name="Sport" type="Sport_t" use="required"/> + </xsd:complexType> + <xsd:complexType name="NextSport_t"> + <xsd:sequence> + <xsd:annotation> + <xsd:documentation> + Each sport contains an optional transition and a run. + </xsd:documentation> + </xsd:annotation> + <xsd:element name="Transition" type="ActivityLap_t" minOccurs="0"/> + <xsd:element name="Run" type="Run_t"/> + </xsd:sequence> + <xsd:attribute name="Sport" type="Sport_t" use="required"/> + </xsd:complexType> + <xsd:simpleType name="Sport_t"> + <xsd:restriction base="xsd:token"> + <xsd:enumeration value="Running"/> + <xsd:enumeration value="Biking"/> + <xsd:enumeration value="Other"/> + </xsd:restriction> + </xsd:simpleType> + <xsd:complexType name="Run_t"> + <xsd:sequence> + <xsd:element name="Lap" type="ActivityLap_t" maxOccurs="unbounded"/> + <xsd:element name="Notes" type="xsd:string" minOccurs="0"/> + <xsd:element name="Training" type="Training_t" minOccurs="0"/> + <xsd:element name="Extensions" type="Extensions_t" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>You can extend Training Center by adding your own elements from another schema here.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="Training_t"> + <xsd:sequence> + <xsd:element name="QuickWorkoutResults" type="QuickWorkout_t" minOccurs="0"/> + <xsd:element name="Plan" type="Plan_t" minOccurs="0"/> + </xsd:sequence> + <xsd:attribute name="VirtualPartner" type="xsd:boolean" use="required"/> + </xsd:complexType> + <xsd:complexType name="QuickWorkout_t"> + <xsd:sequence> + <xsd:element name="TotalTimeSeconds" type="xsd:double"/> + <xsd:element name="DistanceMeters" type="xsd:double"/> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="Plan_t"> + <xsd:sequence> + <xsd:element name="Name" type="RestrictedToken_t" minOccurs="0"/> + <xsd:element name="Extensions" type="Extensions_t" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>You can extend Training Center by adding your own elements from another schema here.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + <xsd:attribute name="Type" type="TrainingType_t" use="required"/> + <xsd:attribute name="IntervalWorkout" type="xsd:boolean" use="required"/> + </xsd:complexType> + <xsd:simpleType name="TrainingType_t"> + <xsd:restriction base="xsd:token"> + <xsd:enumeration value="Workout"/> + <xsd:enumeration value="Course"/> + </xsd:restriction> + </xsd:simpleType> + <xsd:complexType name="ActivityLap_t"> + <xsd:sequence> + <xsd:element name="TotalTimeSeconds" type="xsd:double"/> + <xsd:element name="DistanceMeters" type="xsd:double"/> + <xsd:element name="MaximumSpeed" type="xsd:double" minOccurs="0"/> + <xsd:element name="Calories" type="xsd:unsignedShort"/> + <xsd:element name="AverageHeartRateBpm" type="xsd:unsignedByte" minOccurs="0"/> + <xsd:element name="MaximumHeartRateBpm" type="xsd:unsignedByte" minOccurs="0"/> + <xsd:element name="Intensity" type="Intensity_t"/> + <xsd:element name="Cadence" type="xsd:unsignedByte" minOccurs="0"/> + <xsd:element name="TriggerMethod" type="TriggerMethod_t"/> + <xsd:element name="Track" type="Track_t" minOccurs="0" maxOccurs="unbounded"/> + <xsd:element name="Notes" type="xsd:string" minOccurs="0"/> + <xsd:element name="Extensions" type="Extensions_t" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>You can extend Training Center by adding your own elements from another schema here.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + <xsd:attribute name="StartTime" type="xsd:dateTime" use="required"/> + </xsd:complexType> + <xsd:simpleType name="TriggerMethod_t"> + <xsd:restriction base="xsd:token"> + <xsd:enumeration value="Manual"/> + <xsd:enumeration value="Distance"/> + <xsd:enumeration value="Location"/> + <xsd:enumeration value="Time"/> + <xsd:enumeration value="HeartRate"/> + </xsd:restriction> + </xsd:simpleType> + <xsd:complexType name="Track_t"> + <xsd:sequence> + <xsd:element name="Trackpoint" type="Trackpoint_t" maxOccurs="unbounded"/> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="Trackpoint_t"> + <xsd:sequence> + <xsd:element name="Time" type="xsd:dateTime"/> + <xsd:element name="Position" type="Position_t" minOccurs="0"/> + <xsd:element name="AltitudeMeters" type="xsd:double" minOccurs="0"/> + <xsd:element name="DistanceMeters" type="xsd:double" minOccurs="0"/> + <xsd:element name="HeartRateBpm" type="xsd:unsignedByte" minOccurs="0"/> + <xsd:element name="Cadence" type="xsd:unsignedByte" minOccurs="0"/> + <xsd:element name="SensorState" type="SensorState_t" minOccurs="0"/> + <xsd:element name="Extensions" type="Extensions_t" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>You can extend Training Center by adding your own elements from another schema here.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="Position_t"> + <xsd:sequence> + <xsd:element name="LatitudeDegrees" type="DegreesLatitude_t"/> + <xsd:element name="LongitudeDegrees" type="DegreesLongitude_t"/> + </xsd:sequence> + </xsd:complexType> + <xsd:simpleType name="DegreesLongitude_t"> + <xsd:annotation> + <xsd:documentation/> + </xsd:annotation> + <xsd:restriction base="xsd:double"> + <xsd:maxExclusive value="180.0"/> + <xsd:minInclusive value="-180.0"/> + </xsd:restriction> + </xsd:simpleType> + <xsd:simpleType name="DegreesLatitude_t"> + <xsd:annotation> + <xsd:documentation/> + </xsd:annotation> + <xsd:restriction base="xsd:double"> + <xsd:maxInclusive value="90.0"/> + <xsd:minInclusive value="-90.0"/> + </xsd:restriction> + </xsd:simpleType> + <xsd:simpleType name="SensorState_t"> + <xsd:restriction base="xsd:token"> + <xsd:enumeration value="Present"/> + <xsd:enumeration value="Absent"/> + </xsd:restriction> + </xsd:simpleType> + <xsd:complexType name="Workouts_t"> + <xsd:sequence> + <xsd:element name="Running" type="WorkoutFolder_t"> + <xsd:unique name="RunningSubFolderNamesMustBeUnique"> + <xsd:selector xpath="tc1:Folder"/> + <xsd:field xpath="@Name"/> + </xsd:unique> + </xsd:element> + <xsd:element name="Biking" type="WorkoutFolder_t"> + <xsd:unique name="BikingSubFolderNamesMustBeUnique"> + <xsd:selector xpath="tc1:Folder"/> + <xsd:field xpath="@Name"/> + </xsd:unique> + </xsd:element> + <xsd:element name="Other" type="WorkoutFolder_t"> + <xsd:unique name="OtherSubFolderNamesMustBeUnique"> + <xsd:selector xpath="tc1:Folder"/> + <xsd:field xpath="@Name"/> + </xsd:unique> + </xsd:element> + <xsd:element name="Extensions" type="Extensions_t" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>You can extend Training Center by adding your own elements from another schema here.</xsd:documentation> + </xsd:annotation> + </xsd:element> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="WorkoutFolder_t"> + <xsd:sequence> + <xsd:element name="Folder" type="WorkoutFolder_t" minOccurs="0" maxOccurs="unbounded"> + <xsd:unique name="SubFolderNamesMustBeUnique"> + <xsd:selector xpath="tc1:Folder"/> + <xsd:field xpath="@Name"/> + </xsd:unique> + </xsd:ele... [truncated message content] |