Skip to content

Instantly share code, notes, and snippets.

@slackorama
Created January 17, 2018 18:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save slackorama/b31cd23112ffc1d00dce59fb296e5040 to your computer and use it in GitHub Desktop.
Save slackorama/b31cd23112ffc1d00dce59fb296e5040 to your computer and use it in GitHub Desktop.
from lxml import objectify
tree = objectify.parse('/home/seth/Downloads/slackorama-2018-01-17-pettit-1-9725148.tcx')
root = tree.getroot()
namespaces = {'ns': 'http://www.garmin.com/xmlschemas/TrainingCenterDatabase/v2',
'ns3': 'http://www.garmin.com/xmlschemas/ActivityExtension/v2'}
for tp in root.xpath('//ns:Trackpoint', namespaces=namespaces):
print(tp.Time);
print(tp.xpath('.//ns:Extensions/ns3:TPX/ns3:Watts', namespaces=namespaces)[0])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment