MapServer / MapServer-import

3 stars 2 forks source link

[Context] a context without an XML header can not be loaded #1691

Open tbonfort opened 12 years ago

tbonfort commented 12 years ago

Reporter: bartvde@osgis.nl Date: 2006/03/01 - 08:01

It would be nice if the Mapserver code would be a bit more leniant with respect
to needing an XML header in the WMC file, since e.g. a WMC exported by Ionic
misses this XML header.

This is probably in the CPL XML parsing code.

PHP Warning:  [MapServer Error]: msLoadMapContext(): Invalid XML file
(/data/geoservices/apps/geoservices/htdocs/ionic.cml)
in /data/geoservices/apps/geoservices/htdocs/wmc_ionic.php on line 5
tbonfort commented 12 years ago

Author: jlacroix Date: 2006/03/01 - 16:24

This error is only returned when CPL XML is not able to read the XML file. So
this is a GDAL bug. Frank is there a reason cpl_minixml.cpp needs the XML header?

Here's an example of xml returned by ionic:
  <ViewContext xmlns:xlink="http://www.w3.org/1999/xlink"
xsi:schemaLocation="http://www.opengis.net/context context.xsd"
xmlns="http://www.opengis.net/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="none" version="1.0.0">
    <General>
      <Window width="600" height="300"></Window>
      <BoundingBox SRS="EPSG:4326" miny="34.2" maxy="55.800000000000004"
maxx="28.500000000000007" minx="-14.699999999999996"></BoundingBox>
      <Title>World view</Title>
      <Abstract>Example Context</Abstract>
    </General>
  </ViewContext>

CPL reads it only if we add at the beginning:
<?xml service="1.0" encoding="utf-8" standalone="no"?>
tbonfort commented 12 years ago

Author: fwarmerdam Date: 2006/03/01 - 16:46

Julien,

I saved the document to a file, and ran xmlreformat and it worked
fine.  xmlreformat is a test program that reads and writes a file
with the cpl_minixml.cpp stuff.

Could there be some formatting or special characters lost in the 
bug report paste?  I will attach the literal file I ran this on.

PS. This was with GDAL-CVS, though I don't see any real fixes in
that code since 1.3.1. 
tbonfort commented 12 years ago

Author: fwarmerdam Date: 2006/03/09 - 05:45

Julien / Bart, 

Any follow up on this? 
tbonfort commented 12 years ago

Author: jlacroix Date: 2006/03/09 - 20:45

Sorry I'm unable to compile xmlreformat. I always get:

$ make xmlreformat
/bin/sh ../libtool --mode=compile g++ -Wall  -O2   -DOGR_ENABLED -c -o
xmlreformat.o xmlreformat.cpp
 g++ -Wall -O2 -DOGR_ENABLED -c xmlreformat.cpp  -fPIC -DPIC -o .libs/xmlreformat.o
 g++ -Wall -O2 -DOGR_ENABLED -c xmlreformat.cpp -o xmlreformat.o >/dev/null
2>&1/bin/sh ../libtool --mode=compile g++ -Wall  -O2   xmlreformat.o
../libgdal.la -o xmlreformat
libtool: compile: cannot determine name of library object from `xmlreformat'
make: *** [xmlreformat] Error 1
tbonfort commented 12 years ago

Author: fwarmerdam Date: 2006/03/09 - 21:00

I think you will either need to hand compile xmlreformat or build 
GDAL without libtool (my normal default for local work). 

Hand compilation, assuming installation of gdal in /usr/local, would be:

 g++ gdal/port/xmlreformat.cpp -I/usr/local/include -L/usr/local/lib -lgdal -o
xmlreformat
tbonfort commented 12 years ago

Author: jlacroix Date: 2006/03/09 - 22:21

Thanks Frank!
OK I found the problem, it was on my side. The context code was done so it
always skipped the first XML tag. Fixed in 4.9 CVS.

Marking as FIXED