You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Tried to parse a file with Python 3 looking as follows: <?xml version='1.0' encoding='UTF-8'?> <gpx version='1.1' creator='GPSMID' xmlns='http://www.topografix.com/GPX/1/1'> <trk> <trkseg> <trkpt lat='40.61262' lon='10.592117'> <ele>100</ele> <time>2018-01-01T09:00:00Z</time> </trkpt> </trk> </gpx>
I noticed that the trk tags were missed due to the fact that the parsed node tag name looked like: '{http://www.topografix.com/GPX/1/1}trk', which did not match trk
My workaround was to replace the original tag matching in method from_xml from class GPXField in file gpxfield.py: if child.tag == self.tag:
with a regular expression that would match the tags while ignoring any prefix bound in curly brackets: if re.match('^({[^{]*})?' + self.tag + '$', child.tag) is not None:
To be honest, I did not have the time to dig out why that prefix appeared on the tag...
The text was updated successfully, but these errors were encountered:
Similar issue found for the elevation tag parsing in class GPXComplexField from same file. I implemented a similar workaround that solves the problem in my project
I just wrote a test in (eaef6a7) and there is definitely something weird happening here. Another strange thing is that if you change single to double quotes in xmlns.
Tried to parse a file with Python 3 looking as follows:
<?xml version='1.0' encoding='UTF-8'?> <gpx version='1.1' creator='GPSMID' xmlns='http://www.topografix.com/GPX/1/1'> <trk> <trkseg> <trkpt lat='40.61262' lon='10.592117'> <ele>100</ele> <time>2018-01-01T09:00:00Z</time> </trkpt> </trk> </gpx>
I noticed that the trk tags were missed due to the fact that the parsed node tag name looked like:
'{http://www.topografix.com/GPX/1/1}trk'
, which did not matchtrk
My workaround was to replace the original tag matching in method from_xml from class GPXField in file gpxfield.py:
if child.tag == self.tag:
with a regular expression that would match the tags while ignoring any prefix bound in curly brackets:
if re.match('^({[^{]*})?' + self.tag + '$', child.tag) is not None:
To be honest, I did not have the time to dig out why that prefix appeared on the tag...
The text was updated successfully, but these errors were encountered: