I'm new to gml so probably this is simple question.
If I'm writing to gml and all features have <missing> (or null or empty) attribute called "my_attribute" then "something" wont be written to output GML. How to write it regardles?
This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.
Hi @zzupljanin, if you mean that "null value" for the destination GML is an empty XML element like <my_attribute />, I think you can still use the NullAttributeValueMapper to assign Empty String to the <missing> attribute, so that an empty XML element will be written.
Hi @zzupljanin, if you mean that "null value" for the destination GML is an empty XML element like <my_attribute />, I think you can still use the NullAttributeValueMapper to assign Empty String to the <missing> attribute, so that an empty XML element will be written.
Or, even if you need to write a text value "null" (i.e. <my_attribute>null</my_attribute>) when the attribute is <missing>, <empty>, or <null>, the NullAttributeValueMapper is still helpful. I'm unclear the actual requirement anyway...
I'm guessing you want something like <item xsi:nil="true"/> or <item xsi:nil="true"></item>
FME should do that if:
The FME attribute is set to Null (using the NullAttributeMapper if necessary)
You're using a schema that allows nils, i.e. <xsd:element name="item" nillable="true"/>
minOccurs="1"
I'll freely admit I don't really know what minOccurs is supposed to represent, but I do know this won't work if it is set to 0 (zero).
I hope this helps. Let me know if not and I can ask one of our XML experts to give their opinion.
Right, just to confirm/clarify - you can't write nulls to GML with FME if FME is generating the schema, because there's no way (yet) to define an attribute as nillable. If you use an external schema then it can have a nillable attribute, and FME can write a null value to it.
minOccurs is a bit of a red herring. It seems to be a flag for optional. 1 or more means that the element has to appear. FME generated schemas are always zero meaning optional (nill isn't disallowed, but it isn't defined either).
If using an existing schema, and the schema says that the element is both required (minOccurs="1") and nillable, then the GML writer will generate the element with the xsi:nil="true", because it the schema says it must be present in the output.