XML Mapfiles... are we looking to far?

Tamas Szekeres szekerest at GMAIL.COM
Fri Jul 14 18:15:20 EDT 2006

2006/7/14, Julien, Heryk <hjulien at nrcan.gc.ca>:

> I know that there have been discussions a while back on replacing text
> mapfiles with an xml format. There are many advantages to using an xml
> mapfile format… schema validation being one of the major ones.


Currently the mapfile format should be considered as solely a
serialization format and mapserver translates it internally to a data
structure during the map load. By using one of the scripting
interfaces the map structure could easily be altered and serialized
into another map file if needed. In this regard I cannot really see
the main benefits of replacing the current format to another. What can
a schema validation give more than the current parser checks the
syntax of the file and throws an error if it is incorrect. However
using XSL for automating the map configuration creation is benefical
and one can utilize XML and XSL easily to preprocess and create the
configuration outside of mapserver.

> Initially I thought that making MapServer xml aware would be rather
> complicated since we would have to make major modifications to the
> application. However, I think I was looking too far. I was wondering if we
> could add an xml parser to MapServer that would just apply a simple
> stylesheet (xslt) to an xml mapfile and convert it on the fly to a text
> mapfile that MapServer could use? So Mapserver would continue to work as it
> did with simple text mapfiles. Is this realistic?

In the current implementation mapserver utilizes XML in some areas.
For example the OGC implementation can use the OGR "minixml"
implementation having a parser implementation for processing the xml
files. However we should avoid many of the compulsory dependencies of
several libraries in the core mapserver code. The implementation would
not be so hard but once again  what will we gain over than creating a
simple mapscript to implement this processing chain for example?

> I'm presently considering making a mapfile schema to create xml mapfiles and
> then use an xml parser (Cocoon server) to create static text mapfiles in my
> mapfile directory. However, it would be very cool and useful if MapServer
> could directly parse xml and create its own text mapfiles.

I have no objections about implementing XML and some other
serialization formats to store the map configuration (either a binary
format could make a performance boost), but each of the implementation
should be loosely coupled to mapserver, and the current format should
also be retained. Providing support to create external format
providers may also be compelling.

So let us talk about the benefits in more detail.

Best Regards,

Tamas Szekeres

More information about the mapserver-dev mailing list