Skip to main content
Question

GML schema writer doesn't account for null values in dates


tsirkuse
Participant

I am extracting data from a dB and writing it to a gml file with the GML writer.

I am also writing the xsd schema.

In my data, some dates are empty, and this is normal. However, in the XSD file writen by FME the dates are not nullable. The type of error I am getting is:

_xml_error{5}.desc (string): invalid date value ''

I am wondering if I am doing something wrong or if there is a problem with the xsd writter?

 

 

3 replies

stalknecht
Contributor
Forum|alt.badge.img+19
  • Contributor
  • July 19, 2019

Is it Null or just an empty space?

Look in the XSD and change minOccurs="1" to minOccurs="0" for the date field.


tsirkuse
Participant
  • Author
  • Participant
  • July 19, 2019
stalknecht wrote:

Is it Null or just an empty space?

Look in the XSD and change minOccurs="1" to minOccurs="0" for the date field.

Thank you but there is no minOccurs in the xsd. I tried adding it but it didn't help.

 

 

 

<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns:gml2="http://www.safe.com/gml2" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:gml="http://www.opengis.net/gml" xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.safe.com/gml2" elementFormDefault="qualified">
<import namespace="http://www.opengis.net/gml" schemaLocation="http://schemas.opengis.net/gml/2.1.2/feature.xsd"/>
<element name="FeatureCollection" type="gml2:FeatureCollectionType" substitutionGroup="gml:_FeatureCollection"/>
<element name="dates_test" type="gml2:dates_testType" substitutionGroup="gml:_Feature"/>

<complexType name="FeatureCollectionType">
<complexContent>
<extension base="gml:AbstractFeatureCollectionType">
</extension>
</complexContent>
</complexType>

<complexType name="dates_testType">
<complexContent>
<extension base="gml:AbstractFeatureType">
<sequence>
<element name="ID" type="long"/>
<element name="START" type="date"/>
<element name="END" type="date" nillable="true" minOccurs="0"/>
<choice>
<element ref="gml:polygonProperty"/>
<element ref="gml:multiPolygonProperty"/>
</choice>
</sequence>
</extension>
</complexContent>
</complexType>
</schema>

stalknecht
Contributor
Forum|alt.badge.img+19
  • Contributor
  • July 20, 2019
tsirkuse wrote:

Thank you but there is no minOccurs in the xsd. I tried adding it but it didn't help.

 

 

 

<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns:gml2="http://www.safe.com/gml2" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:gml="http://www.opengis.net/gml" xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.safe.com/gml2" elementFormDefault="qualified">
<import namespace="http://www.opengis.net/gml" schemaLocation="http://schemas.opengis.net/gml/2.1.2/feature.xsd"/>
<element name="FeatureCollection" type="gml2:FeatureCollectionType" substitutionGroup="gml:_FeatureCollection"/>
<element name="dates_test" type="gml2:dates_testType" substitutionGroup="gml:_Feature"/>

<complexType name="FeatureCollectionType">
<complexContent>
<extension base="gml:AbstractFeatureCollectionType">
</extension>
</complexContent>
</complexType>

<complexType name="dates_testType">
<complexContent>
<extension base="gml:AbstractFeatureType">
<sequence>
<element name="ID" type="long"/>
<element name="START" type="date"/>
<element name="END" type="date" nillable="true" minOccurs="0"/>
<choice>
<element ref="gml:polygonProperty"/>
<element ref="gml:multiPolygonProperty"/>
</choice>
</sequence>
</extension>
</complexContent>
</complexType>
</schema>

Can you try to post a FME template? The gml example in your post is readable how is it generated? Which writer do you use?


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings