[gdal-dev] GML element/attribute discovery inconsistency

Björn Harrtell bjorn.harrtell at gmail.com
Tue Nov 27 03:25:06 PST 2018


I think I've found some inconsistencies in GML parsing.

Given the following example GML:

<?xml version="1.0" encoding="UTF-8"?>
<gml:FeatureCollection
  xmlns:gml="http://www.opengis.net/gml/3.2"
  xmlns:ex="http://example.com"
  xmlns:xlink="http://www.w3.org/1999/xlink"
  xmlns:xml="http://www.w3.org/XML/1998/namespace"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  gml:id="id.05e55fe5-b525-4cf2-9977-fedfc0532fd6">
  <gml:featureMember>
    <ex:MyFeaturetype1 gml:id="id.8685d1b8-a851-4034-b8ed-a4c785667386">
      <ex:a1 xsi:nil="true" nilReason="unknown" />
      <ex:a2 uom="m" />
      <ex:a3 xlink:href="https://test.com/value" xlink:title="title" />
      <ex:a4 xlink:href="#id.8685d1b8-a851-4034-b8ed-a4c785667386" />
      <ex:a5 />
    </ex:MyFeaturetype1>
  </gml:featureMember>
</gml:FeatureCollection>

ogrinfo -al will list the following columns:

gml_id: String (0.0) NOT NULL
a1: String (0.0)
a2_uom: String (1.0)

AFAIK it should not define the field a2_uom as GML_ATTRIBUTES_TO_OGR_FIELDS
is NO as default. If I rerun it with GML_ATTRIBUTES_TO_OGR_FIELDS set to
YES the result is:

gml_id: String (0.0) NOT NULL
a1: String (0.0)
a2_uom: String (1.0)
a3_title: String (5.0)
a3_href: String (22.0)
a4_href: String (40.0)

In this case we get more attributes but I think a1_nilReason is missing.

Also, in both cases it seems fields for empty elements are missing (a2, a3,
a4 and a5).

Are my observations correct?

Regards,

Björn
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20181127/10c4deca/attachment.html>


More information about the gdal-dev mailing list