- XML (Extensible Markup Language) Reader/Writer
- XML Quick Facts
- Workbench XML Reader Parameters
- Workbench XML Writer Parameters
- Feature Representation
- Mapping File Reference
- xfMap
- Reading the Input XML Document
- Mapping Rules
- Types of Mapping Rules
- Match and Except Expression
- Specifying Several Match Expressions for One Mapping Rule
- Limiting Mapping Rule Activation with Except Expressions
- Mapping Rule States (activation, execution, suspension, and de-activation)
- Using Force Elements During Mapping Rule Activation and Deactivation
- Search-sets
- Expression Elements (Extract and Literal)
- Expression Sequence
- Feature Mapping Rules
- FME Feature Construction
- Feature Type Element
- Attributes Element
- FME Feature Construction (defining mapping rules under the <feature-content-map> element)
- Attribute Element (handling multiple values)
- Attribute Element (handling optional attributes)
- Attribute Element (sequenced attributes)
- Attribute Element (Nillable Attributes)
- Geometry Element
- Geometry Builder States (activation, execution, suspension, and de-activation)
- Geometry Construction
- Composite Geometry Builders
- Built-in Geometry Builders
- xml-point
- xml-point-xy
- xml-line
- xml-area
- xml-donut
- xml-aggregate
- xml-box
- xml-text
- xml-path
- xml-arc
- xml-arc-by-center-point
- xml-elliptical-arc
- xml-circle
- xml-polygon
- xml-face
- xml-composite-surface
- xml-triangulated-surface
- xml-enclosed-surface
- xml-composite-solid
- xml-multi-point
- xml-multi-curve
- xml-multi-area
- xml-multi-text
- xml-multi-surface
- xml-multi-solid
- xml-null
- xml-reverse-geometry
- xml-geodesic-string
- fme-geometry
- Mapping Segmented Geometric Information
- Geometry Traits (trait element)
- FME Feature Construction (constructing multiple features at a time)
- Structure Element
- References Element
- Apply References Element
- Group Mapping Rules
- Reference Mapping Rules
- Mapping Rules (Optional Elements)
- More Expression Elements
- FME Schema Features
- Reading the Input XML Document
Mapping Segmented Geometric Information
Sometimes it may take more than one mapping rule to successfully extract the geometric data from the elements in the input XML document stream. Consider the following polyline element:
<polyline> <coord>0.0,0.0</coord> <coord>1.1,2.2</coord> <coord>5.3,-1.9</coord> <coord>7.9,3.5</coord> </polyline>
Refer to FME Feature Construction (defining mapping rules under the <feature-content-map> element). It explains when mapping rules should be define under the <feature-content-map> element to handle cases like this one.
What we need here is to activate just one geometry builder B – one that constructs a line geometry. If we just define one feature mapping rule matching the <polyline> element, then we will not be able to give B the contents of all the <coord> elements because B gets suspended when the <polyline> element ceases to be the context element.
Recall that a suspended geometry builder may be set to the state of execution if the currently executing mapping rule contains a <geometry> element having no activate attribute.
We need to re-execute B and pass it the contents of the <coord> element when this element is matched. To achieve, this we define an additional feature mapping rule, that matches a <coord> element and contains a <geometry> element with no activate attribute.
The following xfMap document fragment does exactly this. The built-in geometry builder xml-line constructs polyline features.
<feature-map> <mapping match="polyline"> ... <geometry activate="xml-line"> </geometry> </mapping> </feature-map> <feature-content-map> <mapping match="coord"> ... <geometry> <!-- activate attribute missing, execute the suspended mapping rule passing it the parameters that are defined in the geometry. NOTE: It is an error to define a mapping rule of this form if no geometry builder was activated. --> <data name=”data-string”> <extract expr=”.”/> </data> </geometry> </mapping> </feature-content-map>