- 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
You are here: Popular Formats > XML (Extensible Markup Language) Reader/Writer > xfMap > More Expression Elements > selexpr Expressions
selexpr Expressions
The selexpr expression returns the first, last, or the ith non-empty evaluated expression sequence from its argument list. It is represented in the xfMap document with the <selexpr> element, and it has the following general form:
<selexpr expr=”...”> <arg> <!-- some expression sequence --> </arg> <arg> <!-- some expression sequence --> </arg> ... <arg> <!-- some expression sequence --> </arg> </selexpr>
The expression string (i.e., the expr attribute) specifies the first, last, or ith evaluated non-empty expression sequence to be returned. The valid values for the expression string are first, last, or a positive integer between 1 and k, where k is the number of arguments.
Example
items.xml
<?xml version=”1.0”?> <items> <item> <primary-id>p9384</primary-id> <alternate-id></alternate-id> </item> <item> <primary-id></primary-id> <alternate-id>a2046</alternate-id> </item> <item> <primary-id></primary-id> <alternate-id></alternate-id> </item> </items>
selexpr.xmp
<?xml version=”1.0”?> <xfMap> <feature-map> <mapping match=”item”> <feature-type> <selexpr expr=”first”/> <arg> <extract expr=”./primary-id”/> </arg> <arg> <extract expr=”./alternate-id”/> </arg> <arg> <literal expr=”no-id”/> </arg> </selexpr> </feature-type> </mapping> </feature-map> </xfMap>
FME features constructed:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Feature Type: `p9384' Attribute(string): `xml_type' has value `xml_no_geom' Geometry Type: Unknown (0) =================================================================== +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Feature Type: `a2046' Attribute(string): `xml_type' has value `xml_no_geom' Geometry Type: Unknown (0) =================================================================== +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Feature Type: `no-id' Attribute(string): `xml_type' has value `xml_no_geom' Geometry Type: Unknown (0) ===================================================================