I would like to continue the discussion from this post: GPX Schema validation problems. To go directly to the point, I want to ask how people are parsing and working with GPX files in their software or give me suggestions as to how one should do it.
Although one may say, well just parse the trkpt elements and use them in your software, the things are not that simple for me. Firstly, as discussed in the cited post above, a lot of the gpx-producing-devices(software, gps-handheld-devices, etc) produce gpx files which do NOT conform to the official GPX schema(elements are laid-out in the wrong order, value types changed, elements' names changed, etc.). My initial taught when starting parsing gpx files, is firstly check if they validate against the GPX schema . There are a lot of them which contain the actual GPS data ( sequence of latitude/longitude/elevation values ) but the format in which it is presented ( although nicely hidden by the GPX suffix) may be designed anyhow. So the file will contain the required data, but will not conform to the GPX schema. How is this problem overcomed ? Is there any way to make the software accept generic GPX files as input ?
Secondly, I would like to point out I am not interested in various suggestions you may have(e.g. first pre-process the GPX file and then parse it, change your schema, etc.) as to how to solve the problem. I am more interested if someone knows how things are done in practice. So if anyone has or has had any experience with processing GPX files in (possibly) commercial environment please do share your thoughts.
I hope I made my points clear.
Thanks,
Petar
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…