GPX The GPS Exchange Format logo (click for homepage)

Validating your GPX output

Why Validate?

Your application needs to produce valid GPX output before it can be used with other programs and web services that support GPX. When a developer encounters a GPX file she can't parse, the first question should always be "Is this a valid GPX file?" The GPX validation test provides a consistant answer to this question.

Validating your GPX document

Validation is done using the Xerces XML parser. Download the latest Xerxes distribution from the Apache website. Windows users should download the "Latest Xerces-C++ Binary Package for Windows". Unzip the files, and locate the SAXCount.exe program in the bin folder. This is a command-line utility that will validate your GPX file.

Assuming your GPX file is named my_gpx_file.gpx, and is located in the same folder as SaxCount.exe, use the following command line to validate your file:

SaxCount.exe -v=always -n -s -f my_gpx_file.gpx

If your file validates successfully, SAXCount will display a count of the elements in your file, like the following:

my_gpx_file.gpx: 1012 ms (4025 elems, 1916 attrs, 8048 spaces, 36109 chars)

Any other output from SAXCount.exe indicates that your GPX file is incorrect. It is your responsibility to ensure that any GPX files you create validate successfully against the GPX schema.

GPX Home