<div dir="ltr"><div dir="ltr"><div dir="ltr"><div><br></div><div>Thanks for all the comments!</div><div><br></div><div>I understand that it depends on the schema, what confuses me is the assertion by Andrea in the (quite old) cited email that  "GML and WFS explicitly avoid the use of "xs:nil", I could not find any authoritative support for that claim.</div><div><br></div><div>So, if that is not the case, we should probably fix QGIS Server's DescribeFeatureType to return something like this (for a nillable element):</div><div><br></div><div><element type="long" name="id_long" minOccours="0" /><br></div><div><br></div><div>And for the getFeature response, in case the value is NULL:</div><div><br></div><div><qgs:id<code> </code>xsi:nil="true" /></div><div><br></div>How does it sounds?<br></div><div dir="ltr"><div><br></div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jan 23, 2019 at 11:02 AM Even Rouault <<a href="mailto:even.rouault@spatialys.com">even.rouault@spatialys.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Recent versions of OGR make a difference between :<br>
<br>
- a missing XML element, that will be represented in OGR as a "unset field") <br>
(allowed if the schema has minOccurs="0")<br>
- and a XML element set to <foo xsi:nil="true"/>, that will be represented in <br>
OGR as a NULL field value (allowed if the schema has nillable="true")<br>
<br>
( see <a href="https://trac.osgeo.org/gdal/wiki/rfc67_nullfieldvalues" rel="noreferrer" target="_blank">https://trac.osgeo.org/gdal/wiki/rfc67_nullfieldvalues</a> )<br>
<br>
The same for JSon actually, between a property that doesn't appear at all, or <br>
which is set to null.<br>
<br>
Example, given foo.json with<br>
<br>
{ "type": "FeatureCollection",<br>
  "features": [<br>
    { "type": "Feature", "properties": { "a": 1, "null_prop": null }, <br>
"geometry": null },<br>
    { "type": "Feature", "properties": { "b": 2 }, "geometry": null }<br>
  ]<br>
}<br>
<br>
$ ogr2ogr foo.gml foo.json -f gml<br>
<br>
$ cat foo.gml<br>
<?xml version="1.0" encoding="utf-8" ?><br>
<ogr:FeatureCollection<br>
     xmlns:xsi="<a href="http://www.w3.org/2001/XMLSchema-instance" rel="noreferrer" target="_blank">http://www.w3.org/2001/XMLSchema-instance</a>"<br>
     xsi:schemaLocation="<a href="http://ogr.maptools.org/" rel="noreferrer" target="_blank">http://ogr.maptools.org/</a> foo.xsd"<br>
     xmlns:ogr="<a href="http://ogr.maptools.org/" rel="noreferrer" target="_blank">http://ogr.maptools.org/</a>"<br>
     xmlns:gml="<a href="http://www.opengis.net/gml" rel="noreferrer" target="_blank">http://www.opengis.net/gml</a>"><br>
  <gml:boundedBy><gml:null>missing</gml:null></gml:boundedBy><br>
<br>
  <gml:featureMember><br>
    <ogr:foo fid="foo.0"><br>
      <ogr:a>1</ogr:a><br>
      <ogr:null_prop xsi:nil="true"/><br>
    </ogr:foo><br>
  </gml:featureMember><br>
  <gml:featureMember><br>
    <ogr:foo fid="foo.1"><br>
      <ogr:b>2</ogr:b><br>
    </ogr:foo><br>
  </gml:featureMember><br>
</ogr:FeatureCollection><br>
<br>
$ ogr2ogr out.json foo.gml<br>
<br>
$ ogrinfo foo.gml -al<br>
INFO: Open of `foo.gml'<br>
      using driver `GML' successful.<br>
<br>
Layer name: foo<br>
Geometry: Unknown (any)<br>
Feature Count: 2<br>
Layer SRS WKT:<br>
(unknown)<br>
Geometry Column = geometryProperty<br>
fid: String (0.0) NOT NULL<br>
a: Integer (16.0)<br>
null_prop: String (0.0)<br>
b: Integer (16.0)<br>
OGRFeature(foo):0<br>
  fid (String) = foo.0<br>
  a (Integer) = 1<br>
  null_prop (String) = (null)<br>
<br>
OGRFeature(foo):1<br>
  fid (String) = foo.1<br>
  b (Integer) = 2<br>
<br>
<br>
And yes this is not WFS or GML specific, but XML + XML-Schema generic.<br>
<br>
-- <br>
Spatialys - Geospatial professional services<br>
<a href="http://www.spatialys.com" rel="noreferrer" target="_blank">http://www.spatialys.com</a><br>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature">Alessandro Pasotti<br>w3:   <a href="http://www.itopen.it" target="_blank">www.itopen.it</a></div>