[mapserver-users] Mapfile verification tool

Stephen Woodbridge woodbri at swoodbridge.com
Tue May 15 08:18:41 PDT 2012


On 5/15/2012 11:02 AM, Ivan Mincik wrote:
> On 05/15/2012 03:56 PM, Lime, Steve D (DNR) wrote:
>> Other than using shp2img or one of the other command-line executables I'm afraid there isn't a validator.
>>
>
> What about writing some trivial mapscript script which will loop over
> all layers in mapfile. If some syntax error would be found some
> exception will be raised ?
>
>

Ivan,

I don't think this will work because the mapfile is read all at once and 
parsed into an internal data structure. You can't access it in mapscript 
until the parser has read it and the parser will error out on any errors.

I think you would need to modify the parser and add some kind of error 
recovery to continue parsing the rest of the file to report additional 
errors.

Currently there is no attempt to recover from an error because we assume 
that the mapfile should be valid in the production environment. For 
development/debugging purposes, you would have to add the error recovery 
code.

-Steve W



More information about the MapServer-users mailing list