Skip to content

Commit

Permalink
Merge pull request GPSBabel#17 from tsteven4/master
Browse files Browse the repository at this point in the history
Have the gpx reader forward namespace declarations for http://www.w3.…
  • Loading branch information
tsteven4 committed Dec 19, 2015
2 parents 62cbca7 + a8d988f commit 67d0b6e
Show file tree
Hide file tree
Showing 19 changed files with 67 additions and 38 deletions.
3 changes: 2 additions & 1 deletion gpx.cc
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,8 @@ tag_gpx(const QXmlStreamAttributes& attr)
for (int i = 0; i < ns.size(); ++i) {
QString prefix = ns[i].prefix().toString();
QString namespaceUri = ns[i].namespaceUri().toString();
if (!prefix.isEmpty() && (0 != prefix.compare("xsi"))) {
/* don't toss any xsi declaration, it might used for tt_unknown or passthrough. */
if (!prefix.isEmpty()) {
if (! gpx_namespace_attribute.hasAttribute(prefix.prepend("xmlns:"))) {
gpx_namespace_attribute.append(prefix, namespaceUri);
}
Expand Down
4 changes: 1 addition & 3 deletions reference/arc-project.gpx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
<gpx
version="1.0"
creator="GPSBabel - http://www.gpsbabel.org"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.topografix.com/GPX/1/0"
xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd">
xmlns="http://www.topografix.com/GPX/1/0">
<time>1970-01-01T00:00:00Z</time>
<bounds minlat="28.353803737" minlon="-16.502955209" maxlat="28.359546000" maxlon="-16.494318496"/>
<wpt lat="28.357846000" lon="-16.499208000">
Expand Down
2 changes: 1 addition & 1 deletion reference/basecamp~gpx.gpx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<gpx version="1.1" creator="GPSBabel - http://www.gpsbabel.org" xmlns="http://www.topografix.com/GPX/1/1" xmlns:wptx1="http://www.garmin.com/xmlschemas/WaypointExtension/v1" xmlns:gpxtrx="http://www.garmin.com/xmlschemas/GpxExtensions/v3" xmlns:gpxtpx="http://www.garmin.com/xmlschemas/TrackPointExtension/v1" xmlns:gpxx="http://www.garmin.com/xmlschemas/GpxExtensions/v3" xmlns:trp="http://www.garmin.com/xmlschemas/TripExtensions/v1" xmlns:adv="http://www.garmin.com/xmlschemas/AdventuresExtensions/v1" xmlns:prs="http://www.garmin.com/xmlschemas/PressureExtension/v1">
<gpx version="1.1" creator="GPSBabel - http://www.gpsbabel.org" xmlns="http://www.topografix.com/GPX/1/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wptx1="http://www.garmin.com/xmlschemas/WaypointExtension/v1" xmlns:gpxtrx="http://www.garmin.com/xmlschemas/GpxExtensions/v3" xmlns:gpxtpx="http://www.garmin.com/xmlschemas/TrackPointExtension/v1" xmlns:gpxx="http://www.garmin.com/xmlschemas/GpxExtensions/v3" xmlns:trp="http://www.garmin.com/xmlschemas/TripExtensions/v1" xmlns:adv="http://www.garmin.com/xmlschemas/AdventuresExtensions/v1" xmlns:prs="http://www.garmin.com/xmlschemas/PressureExtension/v1">
<metadata>
<time>1970-01-01T00:00:00Z</time>
<bounds minlat="39.973869715" minlon="-105.498962402" maxlat="40.003967285" maxlon="-105.465850364"/>
Expand Down
4 changes: 1 addition & 3 deletions reference/route/bend-input.gpx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
<gpx
version="1.0"
creator="GPSBabel - http://www.gpsbabel.org"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.topografix.com/GPX/1/0"
xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd">
xmlns="http://www.topografix.com/GPX/1/0">
<time>2011-11-15T17:50:48Z</time>
<bounds minlat="43.439962900" minlon="-3.966600900" maxlat="43.493778700" maxlon="-3.790626500"/>
<rte>
Expand Down
4 changes: 1 addition & 3 deletions reference/track/height.gpx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
<gpx
version="1.0"
creator="GPSBabel - http://www.gpsbabel.org"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.topografix.com/GPX/1/0"
xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd">
xmlns="http://www.topografix.com/GPX/1/0">
<time>1970-01-01T00:00:00Z</time>
<bounds minlat="50.827089869" minlon="6.222871869" maxlat="50.865717758" maxlon="6.245795987"/>
<trk>
Expand Down
4 changes: 1 addition & 3 deletions reference/track/i65.anr.gpx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
<gpx
version="1.0"
creator="GPSBabel - http://www.gpsbabel.org"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.topografix.com/GPX/1/0"
xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd">
xmlns="http://www.topografix.com/GPX/1/0">
<time>2005-09-30T20:18:35Z</time>
<rte>
<name>Home to 8520 Northwe</name>
Expand Down
4 changes: 1 addition & 3 deletions reference/track/seg2trk_test.gpx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
<gpx
version="1.0"
creator="GPSBabel - http://www.gpsbabel.org"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.topografix.com/GPX/1/0"
xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd">
xmlns="http://www.topografix.com/GPX/1/0">
<time>2012-12-03T07:53:56Z</time>
<bounds minlat="46.943588000" minlon="14.156368000" maxlat="50.699530000" maxlon="19.226404000"/>
<trk>
Expand Down
4 changes: 1 addition & 3 deletions reference/track/simpletrack.gpx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
<gpx
version="1.0"
creator="GPSBabel - http://gpsbabel.sourceforge.net"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.topografix.com/GPX/1/0"
xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd">
xmlns="http://www.topografix.com/GPX/1/0">
<time>2004-01-08T20:11:32Z</time>
<trk>
<trkseg>
Expand Down
4 changes: 1 addition & 3 deletions reference/track/simplify-relative.gpx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
<gpx
version="1.0"
creator="GPSBabel - http://www.gpsbabel.org"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.topografix.com/GPX/1/0"
xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd">
xmlns="http://www.topografix.com/GPX/1/0">
<time>2008-08-20T20:50:32Z</time>
<bounds minlat="47.985856533" minlon="7.835891247" maxlat="47.989321947" maxlon="7.839775085"/>
<trk>
Expand Down
4 changes: 1 addition & 3 deletions reference/track/split-raw.gpx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
<gpx
version="1.0"
creator="GPSBabel - http://www.gpsbabel.org"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.topografix.com/GPX/1/0"
xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd">
xmlns="http://www.topografix.com/GPX/1/0">
<time>2010-03-26T00:48:12Z</time>
<bounds minlat="53.556432500" minlon="9.865178669" maxlat="53.556793494" maxlon="9.865555237"/>
<trk>
Expand Down
4 changes: 1 addition & 3 deletions reference/track/trackfilter_discard.gpx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
<gpx
version="1.0"
creator="GPSBabel - http://www.gpsbabel.org"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.topografix.com/GPX/1/0"
xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd">
xmlns="http://www.topografix.com/GPX/1/0">
<time>2012-04-17T08:26:58Z</time>
<bounds minlat="-36.722941300" minlon="142.175800700" maxlat="-36.716685300" maxlon="142.198467900"/>
<trk>
Expand Down
4 changes: 1 addition & 3 deletions reference/track/tracks.gpx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
<gpx
version="1.0"
creator="GPSBabel - http://www.gpsbabel.org"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.topografix.com/GPX/1/0"
xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd">
xmlns="http://www.topografix.com/GPX/1/0">
<time>2007-02-14T15:24:42Z</time>
<bounds minlat="30.045516667" minlon="-91.610566667" maxlat="30.062783333" maxlon="-91.589750000"/>
<trk>
Expand Down
4 changes: 1 addition & 3 deletions reference/track/trk_reverse_test-fwd.gpx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
<gpx
version="1.0"
creator="GPSBabel - http://www.gpsbabel.org"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.topografix.com/GPX/1/0"
xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd">
xmlns="http://www.topografix.com/GPX/1/0">
<time>1970-01-01T00:00:00Z</time>
<bounds minlat="40.000000000" minlon="-106.300000000" maxlat="50.200000000" maxlon="-105.100000000"/>
<trk>
Expand Down
2 changes: 1 addition & 1 deletion reference/transform-rte.gpx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<gpx version="1.1" creator="GPSBabel - http://www.gpsbabel.org" xmlns="http://www.topografix.com/GPX/1/1">
<gpx version="1.1" creator="GPSBabel - http://www.gpsbabel.org" xmlns="http://www.topografix.com/GPX/1/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<metadata>
<time>1970-01-01T00:00:00Z</time>
<bounds minlat="42.401051000" minlon="-71.126602000" maxlat="42.468655000" maxlon="-71.102973000"/>
Expand Down
2 changes: 1 addition & 1 deletion reference/transform-wpt.gpx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<gpx version="1.1" creator="GPSBabel - http://www.gpsbabel.org" xmlns="http://www.topografix.com/GPX/1/1">
<gpx version="1.1" creator="GPSBabel - http://www.gpsbabel.org" xmlns="http://www.topografix.com/GPX/1/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<metadata>
<time>1970-01-01T00:00:00Z</time>
<bounds minlat="42.430950000" minlon="-71.122845000" maxlat="42.467110000" maxlon="-71.105116000"/>
Expand Down
21 changes: 21 additions & 0 deletions reference/unknowntag2.gpx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<gpx xmlns="http://www.topografix.com/GPX/1/1" creator="MapSource 6.12.2" version="1.1" 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">
<rte>
<name>B02222</name>
<extensions>
<gpxx:RouteExtension xmlns:gpxx="http://www.garmin.com/xmlschemas/GpxExtensions/v3" xsi:schemaLocation="http://www.garmin.com/xmlschemas/GpxExtensions/v3 http://www.garmin.com/xmlschemas/GpxExtensions/v3/GpxExtensionsv3.xsd">
<gpxx:IsAutoNamed>false</gpxx:IsAutoNamed>
</gpxx:RouteExtension>
</extensions>
<rtept lat="47.6" lon="-112.0">
<name>A01111</name>
<desc>A St/B St</desc>
<sym>Waypoint</sym>
<extensions>
<gpxx:RoutePointExtension xmlns:gpxx="http://www.garmin.com/xmlschemas/GpxExtensions/v3" xsi:schemaLocation="http://www.garmin.com/xmlschemas/GpxExtensions/v3 http://www.garmin.com/xmlschemas/GpxExtensions/v3/GpxExtensionsv3.xsd">
<gpxx:Subclass>000000000000ffffffffffffffffffffffff</gpxx:Subclass>
</gpxx:RoutePointExtension>
</extensions>
</rtept>
</rte>
</gpx>
25 changes: 25 additions & 0 deletions reference/unknowntag2~gpx.gpx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<gpx version="1.1" creator="GPSBabel - http://www.gpsbabel.org" xmlns="http://www.topografix.com/GPX/1/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<metadata>
<time>1970-01-01T00:00:00Z</time>
<bounds minlat="47.600000000" minlon="-112.000000000" maxlat="47.600000000" maxlon="-112.000000000"/>
</metadata>
<rte>
<name>B02222</name>
<extensions>
<gpxx:RouteExtension xsi:schemaLocation="http://www.garmin.com/xmlschemas/GpxExtensions/v3 http://www.garmin.com/xmlschemas/GpxExtensions/v3/GpxExtensionsv3.xsd" xmlns:gpxx="http://www.garmin.com/xmlschemas/GpxExtensions/v3">
<gpxx:IsAutoNamed>false</gpxx:IsAutoNamed>
</gpxx:RouteExtension>
</extensions>
<rtept lat="47.600000000" lon="-112.000000000">
<name>A01111</name>
<desc>A St/B St</desc>
<sym>Waypoint</sym>
<extensions>
<gpxx:RoutePointExtension xsi:schemaLocation="http://www.garmin.com/xmlschemas/GpxExtensions/v3 http://www.garmin.com/xmlschemas/GpxExtensions/v3/GpxExtensionsv3.xsd" xmlns:gpxx="http://www.garmin.com/xmlschemas/GpxExtensions/v3">
<gpxx:Subclass>000000000000ffffffffffffffffffffffff</gpxx:Subclass>
</gpxx:RoutePointExtension>
</extensions>
</rtept>
</rte>
</gpx>
2 changes: 1 addition & 1 deletion reference/unknowntag~gpx.gpx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<gpx version="1.1" creator="GPSBabel - http://www.gpsbabel.org" xmlns="http://www.topografix.com/GPX/1/1">
<gpx version="1.1" creator="GPSBabel - http://www.gpsbabel.org" xmlns="http://www.topografix.com/GPX/1/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<metadata>
<time>1970-01-01T00:00:00Z</time>
<bounds minlat="47.600000000" minlon="-112.000000000" maxlat="47.600000000" maxlon="-112.000000000"/>
Expand Down
4 changes: 4 additions & 0 deletions testo.d/gpx.test
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,7 @@ compare ${REFERENCE}/basecamp~gpx.gpx ${TMPDIR}/basecamp~gpx_si.gpx
rm -f ${TMPDIR}/unknowntag.gpx
gpsbabel -i gpx -f ${REFERENCE}/unknowntag.gpx -o gpx -F ${TMPDIR}/unknowntag.gpx
compare ${REFERENCE}/unknowntag~gpx.gpx ${TMPDIR}/unknowntag.gpx

rm -f ${TMPDIR}/unknowntag2.gpx
gpsbabel -i gpx -f ${REFERENCE}/unknowntag2.gpx -o gpx -F ${TMPDIR}/unknowntag2.gpx
compare ${REFERENCE}/unknowntag2~gpx.gpx ${TMPDIR}/unknowntag2.gpx

0 comments on commit 67d0b6e

Please sign in to comment.