Opened 4 years ago
Last modified 8 days ago
#2724 new enhancement
[PATCH] Validate GPX
| Reported by: | Henrik Niehaus <henrik.niehaus@…> | Owned by: | team |
|---|---|---|---|
| Priority: | minor | Component: | Core |
| Version: | Keywords: | gpx | |
| Cc: | Henrik, Niehaus, <henrik.niehaus@…> |
Description (last modified by Manu1400)
I have created a patch, which enables validation of GPX files, when they are imported. If an error occurs, a JOptionPane pops up with details from the parser (line, column and error msg).
This shall encourage developers of other software to make their software GPX compliant and inform JOSM users, that it's not JOSM fault, that a file can't be read.
Attachments (1)
Change History (7)
Changed 4 years ago by Henrik Niehaus <henrik.niehaus@…>
comment:1 Changed 4 years ago by stoecker
- Summary changed from [PATCH] Validate GPX to Validate GPX
comment:2 Changed 4 years ago by Henrik Niehaus <henrik.niehaus@…>
Enabling another parser feature:
factory.setFeature("http://apache.org/xml/features/validation/dynamic", true);
enables the parsing only for files, which specify a grammar (schema or dtd).
comment:3 Changed 4 years ago by stoecker
This means removing that line fixes the problem?
comment:4 Changed 4 years ago by Henrik Niehaus <henrik.niehaus@…>
Not removing, but adding this line fixes the problem with the example you posted, because it doesn't specify a schema nor a dtd. So no validation will be done. Invalid files, which specify a dtd or a schema will still fail with an error message.
comment:5 Changed 8 days ago by Manu1400
- Cc Henrik Niehaus <henrik.niehaus@…> added; Henrik Niehaus <henrik.niehaus@…> removed
- Description modified (diff)
- Keywords gpx added
comment:6 Changed 8 days ago by Manu1400
- Summary changed from Validate GPX to [PATCH] Validate GPX



A serious problem of this patch is, that files previously opening fine now fail to load, e.g. this example form another bug report.
Whereas warning the user about defect files is a nice idea enforcing standards behaviour is not.
In its current form I will not apply this patch.