Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

gpxx extensions without namespace #122

Open
yohanboniface opened this issue Sep 26, 2023 · 1 comment
Open

gpxx extensions without namespace #122

yohanboniface opened this issue Sep 26, 2023 · 1 comment

Comments

@yohanboniface
Copy link

Hi Tom!

I've got this report of a file that cannot be imported in uMap, while it is read by other softwares like Viking, Gnome Maps or VisuGPX.

It seems that the file is invalid, because missing the correct namespace for gpxx.

Here is the file:

3Septembre.zip

How do you see that ? Is there a short path to work around that invalid file (like ignoring tags with non declared namespace or such) ?

I'm invoking the Robustness principle :)

Thanks in advance!

Yohan

Initial ref: https://forum.openstreetmap.fr/t/fichier-gpx-qui-ne-semble-pas-fonctionner-sur-umap/17640 (in French)

@tmcw
Copy link
Collaborator

tmcw commented Sep 27, 2023

Hey Yohan, good to hear from you!

Yeah, there are kind of two sides to this:

I want togeojson to detect for when XML is invalid ( #85 ) and report that or throw an error or something, so that this isn't the silent failure it is today.

In terms of the present, though - the parsing error is probably happening in parseFromString off of the DOMParser. DOMParser in the browser doesn't have any options for whether to be strict or lenient - it just parses what it does and doesn't parse what it doesn't - and it won't parse this XML. I think trying to use DOMParser and messing with the XML source to make invalid documents valid… would be tough.

There's another route which is probably better: the @xmldom/xmldom NPM module that togeojson-cli uses and Placemark uses is more lenient and will allow documents with invalid namespaces. Might want to try that, in place of using DOMParser - togeojson works with its generated DOM the same way it works with the browser one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants