DEF Lines

The DEF line controls the generation of the GML application schema when the GML2 writer is set to FIXED or CREATE mode.

The interpretation of a DEF line is dependent on the GML2 writer’s SCHEMA_MODE.

FIXED Mode

The GML instance document output conforms to the FMEFeatures.xsd application schema (Safe Schema). Its namespace prefix is fme and its URL is http://www.safe.com/xml/schemas/FMEFeatures. A copy of the FMEFeatures.xsd schema document may be found under the xfMap folder of the FME installation. In most installations, this location is: C:\Program Files\FME_<version>\xfmap.

This schema declares two GML feature collection elements:

  • fme:schemaFeatures
  • fme:dataFeatures

(Please refer to the FMEFeatures.xsd schema, in the xfMap folder of your FME installation, for the declaration of the GML elements that are in the fme namespace.) Each collection element may contain 1 or more fme:Feature elements.

The fme:Feature can have a feature type, zero or more properties, and optionally one of the predefined geometric properties defined by the GML specification. (See the fme:FeatureType complex type definition in the FMEFeatures.xsd schema document.)

A DEF line specifies the contents of an fme:Feature in the fme:schemaFeatures container element. The <elementName> defines its feature type. Each <attrName> <attrType> pair defines an fme:property element. An additional fme:property with the name xml_type is defined by the value of the <xml_type>.

For example:

When the GML2 Writer writes out an FME feature, it uses its feature type to determine how an fme:Feature element should be written in the fme:dataFeature container.

The FME feature’s feature type must equal one of the DEF lines (<elementName>). Through it, the writer determines the properties and geometry for the data fme:Feature. The geometry is determined by the DEF line’s <xml_type>. It determines which GML geometric primitive is needed in the fme:Feature.

The following table shows the correspondence:

xml_type

GML v2 geometric property element referenced in the fme:Feature

xml_no_geom

none

xml_point

pointProperty, multiPointProperty

xml_line

lineStringProperty, multiLineStringProperty

xml_area

polygonProperty, multiPolygonProperty

xml_text

pointProperty

CREATE Mode

One GML2 DEF line specifies the following in the GML application schema:

  • XML Schema Complex Type Definition
  • XML Schema Global Element Declaration

XML Schema Complex Type Definition

This complex type is named <elementName>Type. It resides in the GML application schema target namespace that is specified with the Target Namespace Prefix and Target Namespace URI writer parameters. It derives by extension from the GML AbstractFeatureType.

The value of <xml_type> determines which GML geometric property will be included as an element reference in the definition of the <elementName>Type complex type.

The following table shows this relation:

xml_type

GML v2 geometric property element referenced in the complex type

xml_no_geom

none

xml_point

pointProperty, multiPointProperty

xml_line

lineStringProperty, multiLineStringProperty

xml_area

polygonProperty, multiPolygonProperty

xml_text

Not supported in CREATE mode

In the above table, if there is more than one GML geometric property element referenced, then the <elementName>Type complex type definition will reference these inside an XML Schema choice element.

Each <attrName> <attrType> in the DEF line specifies an element declaration in the <elementName>Type complex type. The element declaration name is <attrName> and its type is <attrType>. The valid values for <attrType> are: xml_buffer, xml_char(width), xml_int32, xml_real32, xml_decimal(width,decimal), xml_boolean, and xml_real64.

An <attrName> may also be suffixed in the DEF line by {} to indicate that the attribute is a simple list attribute. The GML property generated for this simple list attribute will have its maxOccurs set to unbounded.

XML Schema Global Element Declaration

This global element is declared with the name <elementName>, its type is <elementName>Type, and it is assigned to the GML _Feature substitution group.