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

Cannot read GPX files with missing namespace #55

Open
tipa opened this issue Mar 15, 2022 · 0 comments
Open

Cannot read GPX files with missing namespace #55

tipa opened this issue Mar 15, 2022 · 0 comments

Comments

@tipa
Copy link

tipa commented Mar 15, 2022

I am using Gpx10Serializer and Gpx11Serializer in my app and want to deserialize GPX files from a stream.
I have come across GPX files that do not have the correct namespace set:

<?xml version="1.0" encoding="UTF-8"?>
<gpx creator="Runtastic: Life is short - live long, http://www.runtastic.com" version="1.1" xmlns="http://www.topografix.com/GPX/1/1" xmlns:gpxtpx="http://www.garmin.com/xmlschemas/TrackPointExtension/v1" xmlns:gpxx="http://www.garmin.com/xmlschemas/GpxExtensions/v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd http://www.garmin.com/xmlschemas/GpxExtensions/v3 http://www.garmin.com/xmlschemas/GpxExtensionsv3.xsd http://www.garmin.com/xmlschemas/TrackPointExtension/v1 http://www.garmin.com/xmlschemas/TrackPointExtensionv1.xsd"><metadata><name>runtastic_20220225_0813</name>
<copyright author="www.runtastic.com"><year>2022</year>
<license>http://www.runtastic.com</license>
</copyright>
<link href="http://www.runtastic.com"><text>runtastic</text>
</link>
...
<?xml version="1.0" encoding="UTF-8"?>
<gpx version="1.0" creator="GeoSetter - http://www.geosetter.de">
<trk>
<name></name>
<trkseg>
...

This causes the deserialization to fail with an InvalidOperationException (<gpx xmlns=''> was not expected) because of this attribute (I think):

[XmlRoot("gpx", Namespace="http://www.topografix.com/GPX/1/1", IsNullable=false)]

[XmlRoot("gpx", Namespace="http://www.topografix.com/GPX/1/0", IsNullable=false)]

It would be great if it was possible to ignore that namespace so that the library can also import those GPX files

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

1 participant