I am building an application that works primarily with GPX files as the input data. Given the fact that gpx files are supposed to be defined by the gpx schema (as defined here: http://www.topografix.com/gpx.asp), the first thing that I taught is reasonable to do with my application was to validate the input file against the schema(bearing in mind the different versions of course). So far so good. For the initial files I was testing, everything was perfect. However, sometimes I use .gpx files which turn out to be invalid against the relevant gpx schema. So, I was trying to import them with other similar tools and strangely, no error was returned and the file was parsed perfectly. So, the most logical conclusion is that there is a problem with my code. However, after a thorough investigation, my code was totally fine and no problems with it were at present. This was even verified by the suggested validation technique from topografix.com ( http://www.topografix.com/gpx_validation.asp ) , and it again concluded the file is invalid.
So, it turns out that there are some GPS devices/GPS recording systems/etc. which produce .gpx files without conforming to the official GPX schema. This conclusions leads me to ask the question: WHY ? I seriously do not understand the idea behind it. Furthermore, with most of the invalid files I have found, the problem is not something that may be regarded as an additional feature but is something like not following the right order with some elements' children which I consider to be totally stupid.
This leads me to ask two questions to you. Firstly, I would be happy if someone can explain to me why is that a lot of the GPX files that I found on the web do not conform to the official GPX schema. Secondly, I would like to ask you how do you deal with this problem if you are to parse GPX files. After all, the track points will be in the file anyway, so do I simply have to ignore XML schema validation and proceed with direct parsing ? But then again, if there is a misspelled attribute name, my system would crash. Any information on how do you deal with parsing GPS files will be very much appreciated.
Thanks for your time and help.
Regards,
Petar
EDIT: I have posted a new thread: GPX parsing patterns and "standards" where I am asking how people are actually parsing GPX files in practice. If you have an idea please post your answer there.