You are here: Popular Formats > XML (Extensible Markup Language) Reader/Writer > xfMap > Feature Mapping Rules > FME Feature Construction (constructing multiple features at a time)

FME Feature Construction
(constructing multiple features at a time)

XML data is most often hierarchal than “flat”, and so it is common to encounter elements embedded within elements for which we may want to map both child and parent as features. For example, consider a <building> with <name>, <location> and several <wall> child elements:

<building>
	<name>C10<name>
	<location>east side</location>
	<wall> ... </wall>
	<wall> ... </wall>		
</building>

If we want to map both <building> and <wall> elements as FME features then we need one or more mapping rules matching the <building> and <wall> elements in the xfMap’s <feature-map> element. But by default there’s only one active feature-search-set. In the example above, the <building> element will trigger the construction of a new FME feature, then immediately, the one and only feature-search-set will be set to contain mapping rules from the <feature-content-map> and it will not be set back to the <feature-map> until the </building> end element tag is read, therefore the “wall” mapping rule in the <feature-map> will never be considered for activation.

The xfMap <feature-map> element may have an optional multi-feature-construction attribute whose default value is false but may be settable to true. Setting the multi-feature-construction to true allows the XML reader to construct multiple features a time by instructing it to always create an additional feature-search-set whose content is the <feature-map>, recall that only mapping rules in the <feature-map> trigger the construction of a new feature when activated.

For example:

<feature-map multi-feature-construction=”true”>
	<mapping match="building">
		 ... 
	</mapping>
	<mapping match="wall">
		 ... 
	</mapping>
</feature-map>