[Geoserver-users] Workarounds for issue 634

Hi,

while letting geotools parse a WFS response from an oracle-based geoserver WFS (1.5.3) it seems I hit http://jira.codehaus.org/browse/GEOS-634. So i thought I'd give some input (and ask for a workaround).

WARNUNG: java.io.IOException: org.xml.sax.SAXException: Could not find element handler for http://www.opengis.net/gml : DZ_RESULTS_POLYGONS as a child of FeatureAssociationType.
java.io.IOException: org.xml.sax.SAXException: Could not find element handler for http://www.opengis.net/gml : DZ_RESULTS_POLYGONS as a child of FeatureAssociationType.
  at org.geotools.xml.gml.FCBuffer.hasNext(FCBuffer.java:304)
  at org.geotools.data.wfs.WFSFeatureReader.loadElement(WFSFeatureReader.java:164)
  at org.geotools.data.wfs.WFSFeatureReader.hasNext(WFSFeatureReader.java:153)
  at org.geotools.data.wfs.WFSDataStore.getFeatureReader(WFSDataStore.java:763)
...

DZ_RESULTS_POLYGONS is my FeatureType. The response looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<wfs:FeatureCollection
xmlns="http://www.opengis.net/wfs&quot;
xmlns:wfs="http://www.opengis.net/wfs&quot;
xmlns:gml="http://www.opengis.net/gml&quot;
xmlns:geb="http://my.url"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;
xsi:schemaLocation=" etc etc etc">
     <gml:boundedBy>
         <gml:Box srsName="http://www.opengis.net/gml/srs/epsg.xml#4326&quot;&gt;
             <gml:coordinates xmlns:gml="http://www.opengis.net/gml&quot; decimal="." cs="," ts=" ">7.10746992,50.70431997 7.11434016,50.71524003</gml:coordinates>
         </gml:Box>
     </gml:boundedBy>
     <gml:featureMember>
         <gml:DZ_RESULTS_POLYGONS fid="DZ_RESULTS_POLYGONS.23">
             <gml:TASK_ID>11</gml:TASK_ID>
             <gml:VALUE>120</gml:VALUE>
             <gml:MIN_ANGLE>0.03490658503988659</gml:MIN_ANGLE>
             <gml:PERCENTAGE>65</gml:PERCENTAGE>
             <gml:GEOM>
                 <gml:Polygon srsName="http://www.opengis.net/gml/srs/epsg.xml#4326&quot;&gt;
                     <gml:outerBoundaryIs>
                         <gml:LinearRing>
                             <gml:coordinates xmlns:gml="http://www.opengis.net/gml&quot; decimal="." cs="," ts=" ">7.10971992,50.71361004 7.10823996,50.71524003
...
</gml:coordinates>
                         </gml:LinearRing>
                     </gml:outerBoundaryIs>
                 </gml:Polygon>
             </gml:GEOM>
         </gml:DZ_RESULTS_POLYGONS>
     </gml:featureMember>

     <!-- skip others... -->

</wfs:FeatureCollection>

(Slightely edited for readability's sake.)

It seems the prefixes are wrong
<gml:DZ_RESULTS_POLYGONS fid="DZ_RESULTS_POLYGONS.23">

should read
<geb:DZ_RESULTS_POLYGONS fid="DZ_RESULTS_POLYGONS.23">

where 'geb' is my namespace prefix. The same goes for the properties.

Ok, now to the workaround. Does anyone know how to parse a GML string using geotools or have a snippet for doing that? (Perhaps I should ask on their list :frowning:

Anyway, the WMS looks fine and is displaying the poly OK.

Cheers,

Ugo

--
Ugo Taddei

Fraunhofer Institut Intelligente Analyse- und Informationssysteme (FhG IAIS)
http://www.iais.fraunhofer.de
Department Knowledge Discovery - IAIS.KD -
Working Group Spatial Decision Support
http://www.iais.fraunhofer.de/kd.html
phone (+49)2241-14-2184 fax (+49)2241-14-2072
Schloss Birlinghoven, D-53754 Sankt Augustin, Germany
------------------------------------------------------
Visit our thematic mapping tool CommonGIS: http://www.commongis.de