Modify

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)

validate_gpx.diff.gz (2.1 KB) - added by Henrik Niehaus <henrik.niehaus@…> 4 years ago.

Download all attachments as: .zip

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

A serious problem of this patch is, that files previously opening fine now fail to load, e.g. this example form another bug report.

<?xml version='1.0' encoding='UTF-8'?>
<gpx version='1.1' creator='GPSMID' xmlns='http://www.topografix.com/GPX/1/1'>
<wpt lat='50.10123' lon='14.475168'>
<name>Waypoint 1</name>
<time>2009-05-26T05:09:28Z</time>
</wpt>
</gpx>

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.

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

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as new .
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from team. Next status will be 'new'.
Next status will be 'needinfo'.The owner will change to Henrik Niehaus <henrik.niehaus@gmx.de>
as duplicate The resolution will be set to duplicate. Next status will be 'closed'.The specified ticket will be cross-referenced with this ticket
The owner will be changed from team to anonymous. Next status will be 'assigned'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.