[XML-SIG] element-value in multiple namespace

Christian Benke benkokakao at gmail.com
Sun Nov 30 20:25:37 CET 2008


Hello!

I'm currently struggling to extract some information from a gpx-file
(geodata in xml-format). You can see the xml-content here:
http://benko.login.cx/2008-11-21.xml

So far i've managed to get out most of the values with this function:

tree = etree.parse(gpxfile)
    gpx_namespace = "http://www.topografix.com/GPX/1/1"
    root = tree.getroot()
    trackSegments = root.getiterator("{%s}trkseg"%gpx_namespace)
    for trackSegment in trackSegments:
        for trackPoint in trackSegment:
            lat=trackPoint.attrib['lat']
            lon=trackPoint.attrib['lon']
            altitude=trackPoint.find('{%s}ele'% gpx_namespace).text
            time=trackPoint.find('{%s}time'% gpx_namespace).text


However, i have little idea what the syntax to pick out the
values of the Temperature- and Pressure-elements has to be, which have
an additional namespace, plus they
have a "gpxx:"-prefix. I've struggled yesterday night with
this but didn't succeed. Can someone give me a kick-off how this would
work?

Cheers
Christian


More information about the XML-SIG mailing list