XML Template

Steve Lime steve.lime at DNR.STATE.MN.US
Wed Dec 14 15:16:26 EST 2005

See bug 1518 for a full discussion. I have just committed to code I've been using
here to do just this. There are a couple of new parameters to control the mime-tye
for mode=browse and mode=html with HTML legends. So in the web object you


All take a mime-type as a value and all default to "text/html". This is available in
the 4.8 CVS version and should be in the next beta or candidate release for 4.8

Works nicely. Only thing I'm still debating is the parameter names. Ideally you'd
just have CONTENTTYPE in the various objects but browse and queries aren't
really objects, rather modes. Perhaps QUERYTYPE, LEGENDTYPE and BROWSETYPE
make more sense.


Stephen Lime
Data & Applications Manager

Minnesota DNR
500 Lafayette Road
St. Paul, MN 55155

>>> Steve Lime <steve.lime at DNR.STATE.MN.US> 12/13/05 8:24 PM >>>
There is a bug for this and I have started the fix and hope to finish tomorrow sometime during the day. The version writing would disappear altogether and be replaced with a template substitution. ([version] already exists since 4.4).


>>> Jachym Cepicky <jachym.cepicky at CENTRUM.CZ> 12/13/05 2:21 PM >>>

I had the same problem.. if you did not solve it some better way, try to
open the file mapserv.c and rewrite the lines

   msIO_printf("Content-type: text/html%c%c", 10, 10); /* write MIME header */
   msIO_printf("<!-- %s -->\n", msGetVersion());


   /* I would like xml, please */
   msIO_printf("Content-type: text/xml%c%c", 10, 10); /* write MIME header */
   /* msIO_printf("Content-type: text/html%c%c", 10, 10);
   msIO_printf("<!-- %s -->\n", msGetVersion());*/

and recompile

this is the "quick and dirty way", how to force mapserver to produce
correct xml headers without comments.

To Steve Lime: Sorry, I'm not programer - I know, this is not clean
solving of that problem.  But this is the way, we would
like mapserver handles templates. I would suggest some CONTENTTYPE
option for mapfile. And remove the msGetVersion() printing (at least for
text/xml type).


On Thu, Nov 03, 2005 at 05:24:46PM -0500, Tricia Williams wrote:
> Hi List,
>    I was wondering if it is possible to use an xml template instead of a
> html template to handle nquery results?  I have tried experimenting but
> the results are not recognized as xml.
>    My header contains:
> <?xml version="1.0" encoding="UTF-8"?>
> <result>
>    My template contains:
> <place>
>   ...
> </place>
>    My footer contains:
> </results>
>    Any advice or guidance would be much appreciated.
> Cheers,
> Tricia

Jachym Cepicky
e-mail: jachym.cepicky at centrum.cz 
URL: http://les-ejk.cz 
GPG: http://les-ejk.cz/gnupg_public_key/ 
Department of Geoinformation Technologies
Zem*d*lská 3
613 00 Brno
e-mail: xcepicky at node.mendelu.cz 
URL:    http://mapserver.mendelu.cz 
Tel.:   +420 545 134 514

More information about the mapserver-users mailing list