Parsing WMS-Capabilities
------------------------

                 Key: GEOT-1858
                 URL: http://jira.codehaus.org/browse/GEOT-1858
             Project: GeoTools
          Issue Type: Bug
          Components: ext wms
    Affects Versions: 2.4.4
         Environment: java 1.5, windows xp
            Reporter: Thomas van Gemmeren
            Assignee: Richard Gould


Using the new stable version (2.4.4) of geotools we hvae problems to pars a 
wms-capabilities file. There were no problems with gt2.2.2RC3. 

The problem is the use of the namespace attribute in the WMS_Capabilities-tag.

This works fine
<WMS_Capabilities version="1.3.0">

This leads to an Exception
<WMS_Capabilities version="1.3.0" xmlns="http://www.opengis.net/wms"; 
xmlns:xlink="http://www.w3.org/1999/xlink"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://www.opengis.net/wms 
http://schemas.opengis.net/wms/1.3.0/capabilities_1_3_0.xsd";>
 
Omitting xmlns="http://www.opengis.net/wms";  also works:
<WMS_Capabilities version="1.3.0"  xmlns:xlink="http://www.w3.org/1999/xlink"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://www.opengis.net/wms 
http://schemas.opengis.net/wms/1.3.0/capabilities_1_3_0.xsd";>


The Exception was 
20.06.2008 18:07:10 org.geotools.xml.XMLSAXHandler processException
SCHWERWIEGEND: Should not have any children - this is a simpleType    
org.geotools.xml.handlers.SimpleElementHandler.getHandler(SimpleElementHandler.java:80)
    org.geotools.xml.XMLSAXHandler.startElement(XMLSAXHandler.java:418)
    org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
    org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown 
Source)
    
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
 Source)
    org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown 
Source)
    org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
    org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
    org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
    org.apache.xerces.jaxp.SAXParserImpl.parse(Unknown Source)
    javax.xml.parsers.SAXParser.parse(Unknown Source)
    org.geotools.xml.DocumentFactory.getInstance(DocumentFactory.java:139)
    
org.geotools.data.wms.response.WMSGetCapabilitiesResponse.<init>(WMSGetCapabilitiesResponse.java:50)
    
org.geotools.data.wms.WMS1_0_0$GetCapsRequest.createResponse(WMS1_0_0.java:227)
    
org.geotools.data.ows.AbstractOpenWebService.internalIssueRequest(AbstractOpenWebService.java:362)
    org.geotools.data.wms.WebMapServer.issueRequest(WebMapServer.java:99)
    
org.geotools.data.ows.AbstractOpenWebService.negotiateVersion(AbstractOpenWebService.java:163)
    
org.geotools.data.ows.AbstractOpenWebService.<init>(AbstractOpenWebService.java:68)
    org.geotools.data.wms.WebMapServer.<init>(WebMapServer.java:83)
    
com.rola.rscase.gis.wms.WMSGisMapSupplier.addNewServer(WMSGisMapSupplier.java:529)

There is also the nested Exception:
Should not have any children - this is a simpleType at Line 9 Col 29 tag is: 
ContactPersonPrimary

It seems something to do with the handlers-stack in 
org.geotools.xml.XMLSAXHandler. The stack holds the wrong members -> parent 
should be 'name'-Tag. 
This is wrong. It should be 'ContactInformation'. 'name'-Tag is type simple ->  
Should not have any children.

Here is my capabilities file:

<?xml version="1.0" encoding="UTF-8"?>
<WMS_Capabilities version="1.3.0" xmlns="http://www.opengis.net/wms"; 
xmlns:xlink="http://www.w3.org/1999/xlink"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://www.opengis.net/wms 
http://schemas.opengis.net/wms/1.3.0/capabilities_1_3_0.xsd";>
  <Service>
    <Name>WMS</Name>
    <Title>Test WMS Server</Title>
    <Abstract>This is my WMS Server</Abstract>
    <OnlineResource xlink:href="http://localhost:8080/?"; xlink:type="simple" 
xmlns:xlink="http://www.w3.org/1999/xlink"/>
    <ContactInformation>
      <ContactPersonPrimary>
        <ContactPerson>Mr Sample</ContactPerson>
        <ContactOrganization>Sample Ltd</ContactOrganization>
      </ContactPersonPrimary>
      <ContactPosition>Sample Manager</ContactPosition>
      <ContactAddress>
        <AddressType>postal</AddressType>
        <Address>Sample Street</Address>
        <City>Sample City</City>
        <StateOrProvince>Sample State</StateOrProvince>
        <PostCode>Sample Postal</PostCode>
        <Country>Sample Country</Country>
      </ContactAddress>
      <ContactVoiceTelephone>Sample Phone</ContactVoiceTelephone>
      <ContactElectronicMailAddress>[EMAIL 
PROTECTED]</ContactElectronicMailAddress>
    </ContactInformation>
    <Fees>Sample Fees</Fees>
    <AccessConstraints>Sample Constraints</AccessConstraints>
    <LayerLimit>16</LayerLimit>
    <MaxWidth>2048</MaxWidth>
    <MaxHeight>2048</MaxHeight>
  </Service>
  <Capability>
    <Request>
      <GetCapabilities>
        <Format>text/xml</Format>
        <DCPType>
          <HTTP>
            <Get>
              <OnlineResource xlink:href="http://localhost:8080/?"; 
xlink:type="simple" xmlns:xlink="http://www.w3.org/1999/xlink"/>
            </Get>
            <Post>
              <OnlineResource xlink:href="http://localhost:8080/?"; 
xlink:type="simple" xmlns:xlink="http://www.w3.org/1999/xlink"/>
            </Post>
          </HTTP>
        </DCPType>
      </GetCapabilities>
      <GetMap>
        <Format>image/gif</Format>
        <Format>image/jpeg</Format>
        <Format>image/tiff</Format>
        <DCPType>
          <HTTP>
            <Get>
              <OnlineResource xlink:href="http://localhost:8080/?"; 
xlink:type="simple" xmlns:xlink="http://www.w3.org/1999/xlink"/>
            </Get>
          </HTTP>
        </DCPType>
      </GetMap>
      <GetFeatureInfo>
        <Format>application/vnd.ogc.gml</Format>
        <Format>text/plain</Format>
        <Format>text/html</Format>
        <DCPType>
          <HTTP>
            <Get>
              <OnlineResource xlink:href="http://localhost:8080/?"; 
xlink:type="simple" xmlns:xlink="http://www.w3.org/1999/xlink"/>
            </Get>
          </HTTP>
        </DCPType>
      </GetFeatureInfo>
    </Request>
    <Exception>
      <Format>XML</Format>
      <Format>INIMAGE</Format>
      <Format>BLANK</Format>
    </Exception>
    <Layer>
      <Title>wms_server:layers</Title>
      <CRS>EPSG:32632</CRS>
      <EX_GeographicBoundingBox>
        <westBoundLongitude>17.250000</westBoundLongitude>
        <eastBoundLongitude>9.500000</eastBoundLongitude>
        <southBoundLatitude>46.500000</southBoundLatitude>
        <northBoundLatitude>49.000000</northBoundLatitude>
      </EX_GeographicBoundingBox>
      <BoundingBox CRS="EPSG:32632" minx="9.500000" miny="46.500000" 
maxx="17.250000" maxy="49.000000"/>
      <Layer>
        <Name>kompass</Name>
        <Title>Kompass-Topo</Title>
        <Abstract>Kompass Topografische Karte Österreich</Abstract>
        <CRS>EPSG:32632</CRS>
        <EX_GeographicBoundingBox>
          <westBoundLongitude>17.250000</westBoundLongitude>
          <eastBoundLongitude>9.500000</eastBoundLongitude>
          <southBoundLatitude>46.500000</southBoundLatitude>
          <northBoundLatitude>49.000000</northBoundLatitude>
        </EX_GeographicBoundingBox>
        <BoundingBox CRS="EPSG:32632" minx="9.500000" miny="46.500000" 
maxx="17.250000" maxy="49.000000"/>
      </Layer>
    </Layer>
  </Capability>
</WMS_Capabilities>




-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Geotools-devel mailing list
Geotools-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to