Bug#990641: gpsprune: Cannot load gpx file from OSm route manager (due to blank lines)

Sebastiaan Couwenberg sebastic at xs4all.nl
Sat Jul 3 19:28:10 BST 2021


On 7/3/21 5:23 PM, Wookey wrote:
> I had a look at the gpx spec, and the schema is here:
> https://www.topografix.com/GPX/1/1/gpx.xsd but I guess that whether
> the xml line must be on the very first line is actually part of the
> XML spec. I failed to find a simple validator I could run to check whether 

FWIW:

$ wget https://www.topografix.com/GPX/1/1/gpx.xsd -P /tmp

$ xmllint --noout --schema /tmp/gpx.xsd /tmp/Ceredigion+Coast+Path.gpx
/tmp/Ceredigion+Coast+Path.gpx:13: parser error : XML declaration
allowed only at the start of the document
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
     ^

$ cat /tmp/Ceredigion+Coast+Path.gpx | tidy -xml -i -w -q >
/tmp/Ceredigion+Coast+Path_tidy.gpx

$ xmllint --noout --schema /tmp/gpx.xsd /tmp/Ceredigion+Coast+Path_tidy.gpx
/tmp/Ceredigion+Coast+Path_tidy.gpx validates


libgeo-gpx-perl cannot parse the GPX either:

$ perl -e 'use File::Slurp; use Geo::Gpx; my $xml =
read_file("/tmp/Ceredigion+Coast+Path.gpx"); my $gpx = Geo::Gpx->new(xml
=> $xml); print $gpx->version()."\n";'

XML or text declaration not at start of entity at line 13, column 0,
byte 12 at /usr/share/perl5/XML/TokeParser.pm line 353.

$ perl -e 'use File::Slurp; use Geo::Gpx; my $xml =
read_file("/tmp/Ceredigion+Coast+Path_tidy.gpx"); my $gpx =
Geo::Gpx->new(xml => $xml); print $gpx->version()."\n";'
1.1


Kind Regards,

Bas

-- 
 GPG Key ID: 4096R/6750F10AE88D4AF1
Fingerprint: 8182 DE41 7056 408D 6146  50D1 6750 F10A E88D 4AF1



More information about the Pkg-grass-devel mailing list