<div dir="ltr"><div><br></div>Correct,  thanks for pointing that out!<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jan 23, 2019 at 11:45 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">On mercredi 23 janvier 2019 11:42:19 CET Alessandro Pasotti wrote:<br>
> Thanks for all the comments!<br>
> <br>
> I understand that it depends on the schema, what confuses me is the<br>
> assertion by Andrea in the (quite old) cited email that  "GML and WFS<br>
> explicitly avoid the use of "xs:nil", I could not find any authoritative<br>
> support for that claim.<br>
> <br>
> So, if that is not the case, we should probably fix QGIS Server's<br>
> DescribeFeatureType to return something like this (for a nillable element):<br>
> <br>
> <element type="long" name="id_long" minOccours="0" /><br>
> <br>
> And for the getFeature response, in case the value is NULL:<br>
> <br>
> <qgs:id xsi:nil="true" /><br>
<br>
If you want to be able to set xsi:nil="true", the XSD element declaration must <br>
have the nillable="true" attribute.<br>
minOccurs="0" is to allow the element to be completely absent.<br>
<br>
> <br>
> How does it sounds?<br>
> <br>
> <br>
> On Wed, Jan 23, 2019 at 11:02 AM Even Rouault <<a href="mailto:even.rouault@spatialys.com" target="_blank">even.rouault@spatialys.com</a>><br>
> <br>
> wrote:<br>
> > Recent versions of OGR make a difference between :<br>
> > <br>
> > - a missing XML element, that will be represented in OGR as a "unset<br>
> > field")<br>
> > (allowed if the schema has minOccurs="0")<br>
> > - and a XML element set to <foo xsi:nil="true"/>, that will be represented<br>
> > 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,<br>
> > or<br>
> > which is set to null.<br>
> > <br>
> > Example, given foo.json with<br>
> > <br>
> > { "type": "FeatureCollection",<br>
> > <br>
> >   "features": [<br>
> >   <br>
> >     { "type": "Feature", "properties": { "a": 1, "null_prop": null },<br>
> > <br>
> > "geometry": null },<br>
> > <br>
> >     { "type": "Feature", "properties": { "b": 2 }, "geometry": null }<br>
> >   <br>
> >   ]<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>
> > <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>
> >   <br>
> >   <gml:boundedBy><gml:null>missing</gml:null></gml:boundedBy><br>
> >   <br>
> >   <gml:featureMember><br>
> >   <br>
> >     <ogr:foo fid="foo.0"><br>
> >     <br>
> >       <ogr:a>1</ogr:a><br>
> >       <ogr:null_prop xsi:nil="true"/><br>
> >     <br>
> >     </ogr:foo><br>
> >   <br>
> >   </gml:featureMember><br>
> >   <gml:featureMember><br>
> >   <br>
> >     <ogr:foo fid="foo.1"><br>
> >     <br>
> >       <ogr:b>2</ogr:b><br>
> >     <br>
> >     </ogr:foo><br>
> >   <br>
> >   </gml:featureMember><br>
> > <br>
> > </ogr:FeatureCollection><br>
> > <br>
> > $ ogr2ogr out.json foo.gml<br>
> > <br>
> > $ ogrinfo foo.gml -al<br>
> > INFO: Open of `foo.gml'<br>
> > <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>
> > <br>
> >   fid (String) = foo.0<br>
> >   a (Integer) = 1<br>
> >   null_prop (String) = (null)<br>
> > <br>
> > OGRFeature(foo):1<br>
> > <br>
> >   fid (String) = foo.1<br>
> >   b (Integer) = 2<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>
<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"><div><br></div>-- <br><div dir="ltr" class="gmail_signature">Alessandro Pasotti<br>w3:   <a href="http://www.itopen.it" target="_blank">www.itopen.it</a></div>