#9 geopics GC-ID parser unstable

open
nobody
geopics (7)
5
2010-10-26
2010-10-26
No

Hi,

I always had the problem that geopics reported a lot of errors and printed a huge amount of random data on the screen. The problem is the parser for the GC IDs, it is not very stable and makes some wrong assumptions. For example, that the string "gpx xmlns" is always in the first line. For that reason, geopics handles my GPX files as I assume LOC files.

Attached is a patch to use XML::Twig for XML parsing. I added handlers for geocaching.com gpx and loc files, adding support for more variants should be easy if somebody provides me with example files.

Discussion

  • Thorsten Kukuk

    Thorsten Kukuk - 2010-10-26

    geopics.pl.diff

     
    Attachments
  • Björn Kautler

    Björn Kautler - 2012-10-27

    It doesn't assume "gpx xmlns" in the first line, but "<gpx xmlns:xsd" somewhere which is also wrong, as e. g. GC files have "<gpx xmlns:xsi" and later "xmlns:xsd". I agree that a proper XML parser would be better. But at least changing "<gpx xmlns:xsd" to "<gpx " should be an easy fix for this issue. If it is not recognized as GPX file, just all occurences of GC and then 2 to 5 numbers or characters are used, even if they are in log entries. For example for GPX of GC2BMDQ with the current log entries, GC2BMDQ and GC11VX3 are checked as the latter one is mentioned in a log message.

     
  • Björn Kautler

    Björn Kautler - 2012-10-27

    Thorsten, I guess you should modify your patch so that the Regex variant is still used if the XML Parser fails to parse the file or if it is not a GPX or LOC file, otherwise you loose functionality.

     
  • Björn Kautler

    Björn Kautler - 2012-10-29

    And also your patch eliminates the possibility to feed data via stdin explicitly or implicitly

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks