WFS filter= requires namespaces
-------------------------------
Key: GEOS-501
URL: http://jira.codehaus.org/browse/GEOS-501
Project: GeoServer
Type: Improvement
Reporter: dblasby
Assigned to: dblasby
Fix For: 1.3.0
The error message for this should be more complete. Also, consider telling the parser about the ogc: and gml: namespaces.
Likely to be a pain to actually fix, but a nice error message should be doable.
Since this fails at the parsing phase, you can just send this request to any geoserver configuration.
To get the error, remove the namespace definitions from the <ogc:Filter> element at the beginning of the filter=.
You'll see the actual error in :
org.geotools.filter.FilterFilter.startElement(FilterFilter.java:108)
localname = null, but qname = ogc:... or gml:...
If you define the namesapce then localname will be, for example, "PropertyName" and qname="ogc:PropertyName".
if (localName.equals("Filter"))
There's a high chance that this is happening in multiple places in the parser.
Quick fix -- just throw an understandable error.
Quick fix2 -- predefine ogc: and gml: (perhaps not a good idea and likely difficult)
quick fix3 -- make the qname/localname determination smarter (not a good idea and likely difficult)
More complete fix would require looking at the parser and fixing it up. Its likely we will be replacing the parser, so I'm not sure if it worth the time to do this (people have been saying the parser is going to be replaced for a year...).
----------------------------------
mailing list "Filters in WFS Get request".
okay, I took another look at your filter and the reason its not working is because you are using the "ogc:" and "gml:" namespaces without defining them in your XML fragment.
Use this:
http://localhost:8080/geoserver/wfs?&version=1.0.0&request=GetFeature&service=WFS&typename=gcp:accession&filter=<ogc:Filter xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc"><ogc:And><ogc:BBOX><ogc:PropertyName>LocationGML</ogc:PropertyName><gml:Box srsName="http://www.opengis.net/gml/srs/epsg\.xml%234326"><gml:coordinates>\-5\.416259765625,37\.77071473849608 27.147216796875,47.08508535995383</gml:coordinates></gml:Box></ogc:BBOX><ogc:PropertyIsEqualTo><ogc:PropertyName>Genus</ogc:PropertyName><ogc:Literal>Vicia</ogc:Literal></ogc:PropertyIsEqualTo></ogc:And></ogc:Filter>
<ogc:Filter xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc">
<ogc:And>
<ogc:BBOX>
<ogc:PropertyName>LocationGML</ogc:PropertyName>
<gml:Box srsName="http://www.opengis.net/gml/srs/epsg.xml#4326">
<gml:coordinates>-5.416259765625,37.77071473849608 27.147216796875,47.08508535995383</gml:coordinates>
</gml:Box>
</ogc:BBOX>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>Genus</ogc:PropertyName>
<ogc:Literal>Vicia</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:And>
</ogc:Filter>
Notice that I added:
xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc"
to the <ogc:Filter> element.
--
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