exists

Use

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 .

Example

In the example below, a function description 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).

Field Name

minOccurs

maxOccurs

Field Name

min-Occurs

max-Occurs

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 output a specified string by default if the description -tag does not exist here. This ensures that the target field descriptionOfUse is always completed and is never empty.

Target Field Mapping

Value of Constant()

/FunctionHeadingMsg=/FunctionDeclMsg

 

/FunctionHeadingMsg/technicalName=/FunctionDeclMsg/name

 

/FunctionHeadingMsg/descriptionOfUse= if ( Constant () , Not ( exists (/FunctionDeclMsg/description)) , /FunctionDeclMsg/description)

(No description available)

Example

Source Instance

Result

<?xml version="1.0"encoding="UTF-8"?>

<FunctionDeclMsg>

<name>myFunc</name>

<inputArgtype="String"name="arg1" />

<inputArgtype="String"name="arg2" />

<inputArgtype="String"name="arg3" />

<returnValue type="String" />

</FunctionDeclMsg>

<?xml version="1.0"encoding="UTF-8"?>

<ns0:FunctionHeadingMsgxmlns:ns0="workshopDemo">

<technicalName>myFunc</technicalName>

<descriptionOfUse>(No description available)</descriptionOfUse>

</ns0:FunctionHeadingMsg>