DEF Lines
The DEF lines control the generation of the XML document.
The syntax of the XML DEF line is:
<WriterKeyword>_DEF <table name> \ [<attribute name> <attribute type>]*
The valid values for <attribute type> are: xml_char(width), xml_int32, xml_real32, xml_decimal(width, decimal), xml_boolean, xml_real64, and xml_xml.
A DEF line specifies the form an element takes in the output XML document that represents a table row. The element type is defined in the generated XML Schema document as a Complex Type definition.
For example, the following DEF line:
XML_DEF row \ area xml_real64 \ code xml_char(5) \ num xml_decimal(3,0) fragment xml_xml
generates in the XML Schema document the following XML Schema Complex Type:
<complexType name=”rowType”> <sequence> <element name=”area” type=”double”/> <element name=”code”> <restriction base=”string”> <maxLength value=”5”/> </restriction> </element> <element name=”num”> <restriction base=”decimal”> <totalDigits value=”3”/> <fractionDigits value=”0”/> </restriction> </element> <any min0ccurs="0" processcontents="lax" /> </sequence> </complexType>
An FME feature corresponding to the DEF line, that is, a feature with feature type row, will be written in the output DATASET document as:
<fme:row> <fme:area>28002.325</fme:area> <fme:code>MX02</fme:code> <fme:num>345</fme:num> <gml:pointProperty> _ <gml:PointProperty> </fme:row>
Note: The example assumes that the TARGET_NS_PREFIX has been set to fme
which is the default value.
The “fragment” attribute with “xml_xml” type assumes an XML document as its value. Note that in the example gml prefix must’ve also been bound to a namespace URI in a namespace declaration in the root element, the XML_NAMESPACE_DECLARATIONS directive may be used to add namespace declarations on the root element.
If an XML_DEF line contains multiple attributes that are set to xml_xml type then its corresponding complex type definition will be defined with the “xs:any” wildcard, for example, given the DEF line:
XML_DEF row \ a xml_xml \ b xml_char (5) \ c xml_xml
The corresponding complex type definition in the .xsd document becomes:
<complexType name=”rowType”> <sequence> <any minOccurs=”0” processContent=”lax” maxOccurs=”unbounded”/> </sequence> </complexType>