- 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
- 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
You are here: Popular Formats > XML (Extensible Markup Language) Reader/Writer > xfMap > Reading the Input XML Document > Specifying Several Match Expressions for One Mapping Rule
Specifying several match expressions for one mapping rule
A mapping rule can have more than one match expression. The syntax for multiple match expressions in the <mapping> element’s match attribute is:
(ancestorElement/)*element({index})?([booleanExpr])?
[<whitespace>(ancestorElement/)*element({index})?([booleanExpr])?]*
The match expressions are evaluated in order and a mapping rule R matches an element E if any of the match expressions in the mapping rule matches element E.
For example, consider the following rule XML file:
<?xml version="1.0"?> <c:colours xmlns:c="http://my.colours.com/colours" xmlns:p="http://my.colours.com/primary" xmlns:o="http://my.colours.com/other"> <p:red>255,0,0</p:red> <p:green>0,255,0</p:green> <p:blue>0,0,255</p:blue> <o:orange category="oranges">255,165,0</o:orange> <o:DarkOrange category="oranges">255,140,0</o:DarkOrange> <o:pink>255,192,203</o:pink> <o:brown category="browns">165,42,42</o:brown> <o:beige category="browns">245,245,220</o:beige> </c:colours>
And the following mapping rule fragments:
<xfMap xmlns:c="http://my.colours.com/colours" xmlns:p="http://my.colours.com/primary" xmlns:o="http://my.colours.com/other"> <!-- Note that we bounded the ‘c’, ‘p’, and ‘o’ prefixes to their corresponding URIs in the namespace declarations in the xfMap root element. --> ... <mapping match="c:colours/p:red c:colours/p:green"> <!-- Matches either the red or the green element; notice that the match expressions are whitespace separated. --> </mapping> ... <mapping match="c:colours/o:*[@category='oranges' or @category='browns'] c:colours/p:*"> <!-- Matches any element that belong to the oranges or brown categories or any element that belong to the primary colours namespace. i.e, the ‘orange’, ‘DarkOrange’, ‘brown’, ‘beige’, ‘red’, ‘green’ and ‘blue’ elements --> </mapping> ... <mapping match="c:colours/*[@category-]> <!-- Matches any element having no category attribute, i.e., the ‘red’, ‘green’, ‘blue’, and ‘pink’ elements. --> </mapping> ... <mapping match="c:colours/o:*[@category-]> <!-- Matches any element in the “http://my.colours.com/other” having no category attribute, i.e., the ‘pink’ element. --> </mapping> ... <xfMap>