exists
You use this function to determine whether a particular source field exists in the XML instance to be processed. If it does, exists() returns the value true, otherwise it returns the value false.
In the example below, a function declaration is to be mapped to a structure that merely comprises the technical name and the description of the function. The source structure field description is optional, however, the target structure field descriptionOfUse is mandatory (minOccurs = 1).
Source Structure (Left) and Target Structure (Right)
Field Name |
minOccurs |
maxOccurs |
Field Name |
min- |
max- |
FunctionDeclMsg |
1 |
1 |
FunctionHeadingMsg |
1 |
1 |
name |
1 |
1 |
technicalName |
1 |
1 |
description |
0 |
1 |
descriptionOfUse |
1 |
1 |
inputArg |
0 |
64 |
|
|
|
name (Attr) |
1 |
1 |
|
|
|
type (Attr) |
1 |
1 |
|
|
|
returnValue |
0 |
1 |
|
|
|
type (Attr) |
1 |
1 |
|
|
|
Using the exists() function and other Boolean functions, you can specify a default string to be output if the description tag does not exist. This ensures that the target field descriptionOfUse is always completed and is never empty.
Message Mapping Using exists()
Target Field Mapping |
Value of Constant() |
/FunctionHeadingMsg=/FunctionDeclMsg |
|
/FunctionHeadingMsg/technicalName=/FunctionDeclMsg/name |
|
/FunctionHeadingMsg/descriptionOfUse= |
(No description available) |

The text description of the if standard function must be read as follows:
if ( <result if condition true>,
<condition>,
<result
if condition false>).
Source Instance |
Result |
<?xml version="1.0"
<FunctionDeclMsg> <name> <inputArg <inputArg <inputArg <returnValue type="String" /> </FunctionDeclMsg> |
<?xml version="1.0"
<ns0:FunctionHeadingMsg <technicalName> <descriptionOfUse> </ns0:FunctionHeadingMsg> |