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 descriptionis 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 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.
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(
Example
| Source Instance | Result |
| encoding="UTF-8"?>
| encoding="UTF-8"?>
|






No comments:
Post a Comment