Closed Nymerea closed 10 months ago
The version attribute determines the GPX version, which is either "1.0" or "1.1", according to the GPX-standard. The amazfit watch is creating an invalid GPX file.
You have to fix the version string to "1.1".
In this code
public static Version of(final String version) {
return switch (version) {
case "1.0" -> V10;
case "1.1" -> V11;
default -> throw new IllegalArgumentException(format(
"Unknown version string: '%s'.", version
));
};
}
can't we make it return V11 by default ?
Since the given GPX file is invalid, this is not my preferred fix. But I can imagine, that such files are readable with lenient mode.
final var gpx = GPX.Reader
.of(Mode.LENIENT)
.read("invalid.gpx");
Merged into r3.1.0.
Thanks a million for the fix. I had to write my own parser with xstream. I will happilly migrate to jpx :-)
Hi, I cannot parse a gpx file imported from my amazfit watch.
java.io.InvalidObjectException: Invalid GPX: Invalid value for 'version': Unknown version string: '7.7.5-play'.
here is an exemple of the gpx file :