Opened 18 years ago

Closed 18 years ago

#1691 closed enhancement (fixed)

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

Reported by: bartvde@… Owned by: mapserverbugs
Priority: high Milestone:
Component: MapScript-PHP Version: 4.8
Severity: minor Keywords:
Cc:

Description

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

Attachments (1)

test.zip (454 bytes ) - added by fwarmerdam 18 years ago.
test.xml file in zip

Download all attachments as: .zip

Change History (7)

comment:1 by jlacroix, 18 years ago

Cc: warmerdam@… added
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"?>

comment:2 by fwarmerdam, 18 years ago

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. 

by fwarmerdam, 18 years ago

Attachment: test.zip added

test.xml file in zip

comment:3 by fwarmerdam, 18 years ago

Julien / Bart, 

Any follow up on this? 

comment:4 by jlacroix, 18 years ago

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

comment:5 by fwarmerdam, 18 years ago

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


comment:6 by jlacroix, 18 years ago

Resolution: fixed
Status: newclosed
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
Note: See TracTickets for help on using tickets.