[mapserver-users] WMS getcapabilities error: invalid character

Paul Ramsey pramsey at refractions.net
Tue Jun 25 19:55:46 EDT 2002


Mapserver will merrily spit whatever you put in your wms_* metadata
lines into the XML capabilities, even if the contents of the metadata is
not valid XML. The solution is to use XML entities where necessary:

Replace all occurences of & with &
Replace all occurences of < with &lt;
Replace all occurences of > with &gt;

That will fix the XML problems. As Daniel also notes, if your data is a
URL, you should be careful to URL-encode the data you put in that URL,
but that is good advice for any web programming, not just mapserver :)

Paul

Daniel Morissette wrote:
> 
> Tyler,
> 
> The problem is likely the trailing "&" character in your onlineresource
> url.  A bug has been filed about this already:
> http://mapserver.gis.umn.edu/bugs/show_bug.cgi?id=139
> 
> You can try omitting the trailing "&" and IE should be happier, but that
> may not work for all WMS clients.  Until this is fixed, you should also
> encode the characters ":" as %3A and "\" as %5C
> 
> Daniel
> 
> Tyler Mitchell wrote:
> >
> > I'm getting this error when I do a getcapabilities to a WMS.  I'm not sure
> > that I don't have problems with the map file wms settings, but wondered if
> > anyone can shed some light on it for me.  Is it a bogus message or does it
> > mean something that my small mind can comprehend?  Is my resource url wrong
> > in my map file:
> >
> > Mapfile setting:
> >     WMS_ONLINERESOURCE "http://localhost/mapserver/mapserv?map=c:
> > \inetpub\wwwroot\tyler\demo_test.map&"
> >
> > Does it have to be a internet accessible url?
> >
> > Here's the error I get (internet exploder).
> >
> > -------------------------
> >
> > The XML page cannot be displayed
> > Cannot view XML input using XSL style sheet. Please correct the error and
> > then click the Refresh button, or try again later.
> >
> > A name was started with an invalid character. Line 12, Position 97
> >
> >   <OnlineResource>http://localhost/mapserver/mapserv?map=c:
> > \inetpub\wwwroot\tyler\demo_test.map&</OnlineResource>
> > ------------------------------------------------------------------------------------------------^

-- 
      __
     /
     | Paul Ramsey
     | Refractions Research
     | Email: pramsey at refractions.net
     | Phone: (250) 885-0632
     \_



More information about the mapserver-users mailing list