Opened 14 years ago

Closed 14 years ago

#3299 closed defect (fixed)

Incorrect case in XML syntax for gml:null in a getfeature response

Reported by: nsavard Owned by: tomkralidis
Priority: normal Milestone: 6.0 release
Component: WFS Server Version: svn-trunk (development)
Severity: normal Keywords: wfs1.1 getfeature response Null
Cc: assefa, dmorissette, sdlime

Description

Change History (17)

comment:1 by tomkralidis, 14 years ago

Owner: changed from mapserverbugs to tomkralidis
Status: newassigned

Norm: fixed in r9827. Can you check and verify?

comment:2 by nsavard, 14 years ago

Yes Tom, I'll check that.

comment:3 by assefa, 14 years ago

ref: CITE test GetFeature-Get Test wfs:wfs-1.1.0-Basic-GetFeature-tc8.3

Note that the gml:null is valid for gml2.x (wfs1.0) (http://schemas.opengis.net/gml/2.1.1/feature.xsd)

gml:Null is for gml3.x (wfs1.1) (http://schemas.opengis.net/gml/3.1.1/base/basicTypes.xsd)

Another note the CITE test uses the GML SF-0 profile whne validating outputs (http://schemas.opengis.net/gml/3.1.1/profiles/gmlsfProfile/1.0.0/gmlsf.xsd). In this profile gml:boundedBy can only have an Envelop elelement (no Null element). I believe we should generate an Envelop element with the current bbox of the map and srs instead of the Null element to conform to the GML level 0 profile

comment:4 by nsavard, 14 years ago

That makes sense for me.

comment:5 by nsavard, 14 years ago

Re #comment:3

Maybe we're waiting for each other to act on this issue. Tom, is it you who is going to fix this issue?

comment:6 by tomkralidis, 14 years ago

Norm: thanks for the clarification.

Notes:

  • in GML SF-0, gml:boundedBy is an optional element. We *could* ignore printing this out when using this profile in this case

Assefa: implementation questions:

  • should we generate gml:Envelope with map.extent/srs instead of NULL for GML SF-0? Or not print out gml:boundedBy (for cases of no data returned)?
  • how do we know whether the WFS client is asking for GML SF-0 as Norm states above, as opposed to plain old GML 3?
  • here's the logic I'm proposing
    • if GML2 print out gml:null
    • if GML3 print out gml:Null
    • if GML SF-0 print out gml:boundedBy/gml:Envelope with map.extent/srs OR don't print gml:boundedBy at all

Comments?

comment:7 by tomkralidis, 14 years ago

Cc: dmorissette added

comment:8 by assefa, 14 years ago

Cc: sdlime added

I was under the impression that the current GML3 output of MapServer is based on GML SF-0. Isn't that the case? So users should always expect GML SF-0.

If so we should also send something valid in GML SF-0 for cases where no features is found.

comment:9 by sdlime, 14 years ago

Yup, GML3 driver was based on the simple features profile (I thought). XML sucks...

Steve

comment:10 by tomkralidis, 14 years ago

Update: it turns out GML SF-0 _does_ support gml:Null as well. So we don't have to worry about writing out gml:Envelope.

Here's the proposed patch, then:

Index: mapwfs.c
===================================================================
--- mapwfs.c    (revision 10152)
+++ mapwfs.c    (working copy)
@@ -2225,7 +2225,10 @@
     
     if (((iNumberOfFeatures==0) || (maxfeatures == 0)) && iResultTypeHits == 0) {
       msIO_printf("   <gml:boundedBy>\n"); 
-      msIO_printf("      <gml:Null>missing</gml:Null>\n");
+      if(outputformat == OWS_GML3)
+        msIO_printf("      <gml:Null>missing</gml:Null>\n");
+      else
+        msIO_printf("      <gml:null>missing</gml:null>\n");
       msIO_printf("   </gml:boundedBy>\n"); 
     }

Comments before I commit?

comment:11 by sdlime, 14 years ago

Should this be implemented as a function in mapgml.c instead? Something like:

void gmlWriteNullFeature(FILE *stream, int outputformat) [
  msIO_fprintf(stream, "   <gml:boundedBy>\n");
  if(outputformat == OWS_GML3)
    msIO_fprintf(stream, "      <gml:Null>missing</gml:Null>\n");
  else
    msIO_fprintf(stream, "      <gml:null>missing</gml:null>\n");
  msIO_fprintf(stream, "   </gml:boundedBy>\n");
}

Just wondering if we'd use it elsewhere...

Steve

comment:12 by assefa, 14 years ago

Tom,

I am looking into http://schemas.opengis.net/gml/3.1.1/base/basicTypes.xsd and from what I can see boundedBy can only have a gml:Envelope

Is that correct or is this the correct xsd?

in reply to:  12 comment:13 by tomkralidis, 14 years ago

Replying to assefa:

Tom,

I am looking into http://schemas.opengis.net/gml/3.1.1/base/basicTypes.xsd and from what I can see boundedBy can only have a gml:Envelope

Is that correct or is this the correct xsd?

I don't see it in http://schemas.opengis.net/gml/3.1.1/base/basicTypes.xsd, but now I do see it in http://schemas.opengis.net/gml/3.1.1/profiles/gmlsfProfile/1.0.0/gmlsf.xsd (something with my XMLSpy cache).

Then again, I don't see any explicit reference to using the gmlsf schemas or namespaces in the codebase. Are we really using gmlsf or not?

comment:14 by assefa, 14 years ago

Do you mean the xsd link that we are referring in the code (gml/3.1.1/base/gml.xsd)? I think that should be changed to the gml sf-0 but I have not checked if our output is compatible with the SF-0 schema.

in reply to:  14 comment:15 by tomkralidis, 14 years ago

Replying to assefa:

Do you mean the xsd link that we are referring in the code (gml/3.1.1/base/gml.xsd)? I think that should be changed to the gml sf-0 but I have not checked if our output is compatible with the SF-0 schema.

I wonder how much change that would cause.

Nevertheless, looking again at http://schemas.opengis.net/gml/3.1.1/profiles/gmlsfProfile/1.0.0/gmlsf.xsd, you will see that gml:boundedBy only allows for gml:Envelope at the _feature_ level, as opposed to featurecollection level, per this ticket.

comment:16 by assefa, 14 years ago

I did not realize this. I won't be able to get to the cite tests again before few weeks and at time I will see of It passes these particular tests. I have no more objection to your proposed commits. I will comment in this bug again if I have trouble with the tests (understanding if the cite tests or MapServer is at fault)

comment:17 by tomkralidis, 14 years ago

Resolution: fixed
Status: assignedclosed

Committed in r10158. This handles vanilla GML2/GML3. We don't _formally_ support gmlsf, so we can tackle that in a separate ticket.

Note: See TracTickets for help on using tickets.