I have a C++ program, where the user can pic a .xml file in which tracks are stored. Basically these files are .gpx files with a minor change so the pugixml can read it. How can I make sure that the file the user selected has the right format? It is for example important, that the
<?xml version='1.0' encoding='UTF-8'?>
<trkpt lat="48.08162894291554" lon="11.274891365644537">
<trkpt lat="48.08167553246409" lon="11.274872590181431">
<trkpt lat="48.08162939089216" lon="11.274952385899628">
I know two ways to validate
Both validation methods should be handled by the parser. Which method to choose depends on the level of granularity you need for validation, whereby XSD (Schema) is more sophisticated and on what is available for you. So if there is a DTD (Doctype Definition) is available, is might be more "easy" to just use that. You can of course write some code which does the validation, too, but I guess that is not the "easy way" you are looking for.