Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Prefix format reserved for internal use #117

Closed
tkrajina opened this issue Jun 1, 2018 · 5 comments
Closed

Prefix format reserved for internal use #117

tkrajina opened this issue Jun 1, 2018 · 5 comments

Comments

@tkrajina
Copy link
Owner

tkrajina commented Jun 1, 2018

Example XML (from @jedie in #115 (comment)):

<?xml version="1.0" encoding="UTF-8"?>
<gpx creator="Garmin Connect" version="1.1"
  xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/11.xsd"
  xmlns:ns3="http://www.garmin.com/xmlschemas/TrackPointExtension/v1"
  xmlns="http://www.topografix.com/GPX/1/1"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns2="http://www.garmin.com/xmlschemas/GpxExtensions/v3">
  <metadata>
    <link href="connect.garmin.com">
      <text>Garmin Connect</text>
    </link>
    <time>2018-02-21T14:30:50.000Z</time>
  </metadata>
  <trk>
    <name>Foo Bar</name>
    <type>running</type>
    <trkseg>
      <trkpt lat="51.43788929097354412078857421875" lon="6.617012657225131988525390625">
        <ele>23.6000003814697265625</ele>
        <time>2018-02-21T14:30:50.000Z</time>
        <extensions>
          <ns3:TrackPointExtension>
            <ns3:hr>125</ns3:hr>
            <ns3:cad>75</ns3:cad>
          </ns3:TrackPointExtension>
        </extensions>
      </trkpt>
      <trkpt lat="51.43786800093948841094970703125" lon="6.6170061193406581878662109375">
        <ele>23.6000003814697265625</ele>
        <time>2018-02-21T14:30:51.000Z</time>
        <extensions>
          <ns3:TrackPointExtension>
            <ns3:hr>123</ns3:hr>
            <ns3:cad>75</ns3:cad>
          </ns3:TrackPointExtension>
        </extensions>
      </trkpt>
      <trkpt lat="51.4378472976386547088623046875" lon="6.61700570024549961090087890625">
        <ele>23.799999237060546875</ele>
        <time>2018-02-21T14:30:52.000Z</time>
        <extensions>
          <ns3:TrackPointExtension>
            <ns3:hr>124</ns3:hr>
            <ns3:cad>75</ns3:cad>
          </ns3:TrackPointExtension>
        </extensions>
      </trkpt>
    </trkseg>
  </trk>
</gpx>

I get this:

Traceback (most recent call last):
  File "test.py", line 19, in <module>
    gpx_parser.parse()
  File "gpxpy/gpxpy/parser.py", line 97, in parse
    mod_etree.register_namespace(prefix, URI.strip('"'))
  File "src/lxml/etree.pyx", line 184, in lxml.etree.register_namespace
ValueError: Prefix format reserved for internal use
@tkrajina
Copy link
Owner Author

tkrajina commented Jun 1, 2018

@jedie I see. I pushed now a temporary branch in ns-namespace with a hotfix that should fix it, but it needs more testing.

jedie added a commit to jedie/django-for-runners that referenced this issue Jun 2, 2018
@jedie
Copy link
Contributor

jedie commented Jun 2, 2018

It works here, thanks!

@jedie
Copy link
Contributor

jedie commented Jun 2, 2018

@tkrajina Question: Is it possible to the the values by name? e.g.: point.extensions.get("hr")

jedie added a commit to jedie/django-for-runners that referenced this issue Jun 2, 2018
@tkrajina
Copy link
Owner Author

tkrajina commented Jun 6, 2018

OK, so this is merged in master.

@jedie Unfortunately point.extensions.get("hr") isn't possible yet. I was thinking to create an abstraction to simplify handling of extensions (and it should definitely be part of one of 1.3.x releases), but I'm not yet sure how to implement it.

@tkrajina tkrajina closed this as completed Jun 6, 2018
@jedie
Copy link
Contributor

jedie commented Jun 6, 2018

I created #119 for point.extensions.get("hr") ;)

jedie added a commit to jedie/django-for-runners that referenced this issue Jun 12, 2018
Yell0wflash pushed a commit to Yell0wflash/django-for-runners that referenced this issue May 16, 2023
Yell0wflash pushed a commit to Yell0wflash/django-for-runners that referenced this issue May 16, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants