iamdanfox / gpxsplitter

http://iamdanfox.github.io/gpxsplitter/
9 stars 2 forks source link

Part2 file duplicates xml header #12

Open ComputerDruid opened 1 year ago

ComputerDruid commented 1 year ago

When I split a gpx file from ridewithgps, ridewithgps failed to re-import part2. Turns out that was because part2 duplicated the xml header, looking like:

<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<gpx xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.topografix.com/GPX/1/1" xmlns:gpxdata="http://www.cluetrust.com/XML/GPXDATA/1/0" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd http://www.cluetrust.com/XML/GPXDATA/1/0 http://www.cluetrust.com/Schemas/gpxdata10.xsd" version="1.1" creator="http://ridewithgps.com/">
  <metadata>
    <name>04/21/23</name>
    <time>2023-04-21T23:41:56Z</time>
  </metadata>
  <trk>
    <name>04/21/23 (part 2) (part 2)</name>
    <trkseg>

When I snipped off that first (duplicated) line, it imported no problem. So I was actually able to use this (nice) tool to successfully split my activity, so thanks for creating it!

I've attached the file I was using to reproduce, but it doesn't seem like it has all that much to do with the file I'm using.

repro2.zip