Modify

Opened 15 years ago

Closed 11 years ago

#2724 closed enhancement (wontfix)

[PATCH] Validate GPX

Reported by: hampelratte Owned by: team
Priority: minor Milestone:
Component: Core Version:
Keywords: gpx Cc: hampelratte

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 hampelratte 15 years ago.

Download all attachments as: .zip

Change History (8)

by hampelratte, 15 years ago

Attachment: validate_gpx.diff.gz added

comment:1 by stoecker, 15 years ago

Summary: [PATCH] Validate GPXValidate 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 by hampelratte, 15 years ago

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 by stoecker, 15 years ago

This means removing that line fixes the problem?

comment:4 by hampelratte, 15 years ago

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 by Manu1400, 12 years ago

Description: modified (diff)
Keywords: gpx added

comment:6 by Manu1400, 12 years ago

Summary: Validate GPX[PATCH] Validate GPX

comment:7 by stoecker, 11 years ago

Resolution: wontfix
Status: newclosed

I'm still not convinced and it works fine without. We follow the rule strict for exports, liberal for imports.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.