Feature-type Element
Every feature mapping rule may (this is an optional element) contain one feature-type element, the contents of this element is an expression sequence whose value becomes the feature type of the constructed FME feature. This is represented in xfMap by the <feature-type> element:
<feature-type> <!-- the content is some expression sequence --> </feature-type>
Note: The feature type for the FME feature that is under construction is set only by the first activated feature mapping rule that contains a <feature-type> element. Subsequent feature mapping rules with <feature-type> elements for the same FME feature under construction are ignored by the XML Reader.
The following xfMap document, feature_type.xmp, contains a mapping rule Rp that matches a <point> element from the input points1.xml document. Here Rp has a <feature-type> element that instructs the XML Reader to set the feature type for the FME feature that is under construction.
feature_type.xmp
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE xfMap SYSTEM "xfMap.dtd"> <xfMap> <feature-map> <!-- Call this mapping rule Rp --> <mapping match="point"> <feature-type> <!-- the feature-type element has as its contents an xfMap expression sequence. An expression sequence is a sequence of expression elements. --> <extract expr="@name"/> <literal expr="_"/> <extract expr="@num"/> </feature-type> </mapping> </feature-map> </xfMap>
When the points1.xml and the above feature_type.xmp documents are fed into the XML Reader, the following FME features are constructed:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Feature Type: myPoint_0'
Attribute: xml_type' has value xml_no_geom'
Geometry Type: Unknown (0)
==============================================================
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Feature Type: myPoint_1'
Attribute: xml_type' has value xml_no_geom'
Geometry Type: Unknown (0)
==============================================================