MS RFC 51: XML Mapfile Format




Alan Boudreault


aboudreault at

Last Edited:



MapServer 6.0


Presently, MapServer supports only normal mapfiles that are parsed by Flex. The current mapfiles are parsed very fast by MapServer but can not be parsed by any other software due to the parser complexity. So, a client interface to build mapfiles is difficult to make.

The need we are trying to address is the ability to build MapFile Editors that would be facilitated by the existence of a XML mapfile format (since the current mapfile format makes it impossible to write a forward-compatible parser). XML is seen as a solution that can provide a strict syntax to mapfiles to have a strong validation with XML Schema.

This RFC proposes the addition of XML Mapfile support.

Technical Solution

It was decided that for the time being we should develop a XML schema and a XSLT to convert from XML to text mapfile. If the new XML format takes off then we may consider implementing support for it directly in MapServer in a future release.


An example of XML mapfile layer definition (prototype):

    <item name="DESCRIPTION">Cities</item>
    <item name="TEST">TESTING</item>
    <item name="RESULT_FIELDS">NAME</item>

    <Label type="TRUETYPE">
      <outlineColor red="255" green="255" blue="255"/>
    <color red="0" green="255" blue="0"/>

    <Label type="TRUETYPE">
      <outlineColor red="255" green="255" blue="255"/>

Future Enhancement

In the future, some enhancement could be good to added:

  • Special tags for all WMS options (including styles)

  • Reusable xml block with ID



Backwards Incompatibility

No issues expected.

Bug ID