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
GPX that is created has a bug, which is not bothering all parsers but some (e.g. Garmin Connect) which are more strict and refuse to parse it. The bug is because xlmns attribute is handled incorrectly and depending on browser (esp. Firefox) results in invalid GPX string after XML-serialization: either xlmns attribute is missing in gpx element and / or there is an extra xlmns="" attribute in other elements.
Ref old Firefox bug report that helped to find the root cause & fix: Bugzilla: xlmns dropped
Fix (I can prepare PR later if desired):
//const gpx = doc.createElement('gpx');
const gpx = createElementWithNS('gpx');
//gpx.setAttribute('xmlns', 'http://www.topografix.com/GPX/1/1');
function createElementWithNS(tagName: string): Element {
return doc.createElementNS('http://www.topografix.com/GPX/1/1', tagName);
}
and replace all other occurrences of doc.createElement() in the code with createElementWithNS().
The text was updated successfully, but these errors were encountered:
That was a quick PR! Thanks for creating this 0 dep gpx export library! When I run into this bug I first considered just switching to another library, but all of them seem to come with quite some dep issues or have been created for nodejs rather than browser.
GPX that is created has a bug, which is not bothering all parsers but some (e.g. Garmin Connect) which are more strict and refuse to parse it. The bug is because xlmns attribute is handled incorrectly and depending on browser (esp. Firefox) results in invalid GPX string after XML-serialization: either xlmns attribute is missing in gpx element and / or there is an extra xlmns="" attribute in other elements.
Ref old Firefox bug report that helped to find the root cause & fix: Bugzilla: xlmns dropped
Fix (I can prepare PR later if desired):
and replace all other occurrences of
doc.createElement()
in the code withcreateElementWithNS()
.The text was updated successfully, but these errors were encountered: