Creating a normal advanced XML condition
You can create a normal advance XML condition by using the procedure that is described here.
About this task
To create a normal advanced XML condition:
Procedure
- Expand the Java™ project that you created.
- In the Project Explorer hierarchy, select the *.greex file. Right-click and select Open With > Greex Model Editor from the pop-up menu.
- Expand the tree structure that appears in the Greex Editor.
Click on a node from the tree. All child leaves of the node are listed. The Document Root element contains the Greex Rule root element.
- Select the Greex Rule root element in the Properties view.
Enter the values for various attributes. See the following table for the description of various attributes of the Greex Rule root element.
- In the Properties view, you can view various properties
of the selected element. To open the Properties View:
- From the menu bar, select Window > Show View > Other.... From the list of views under Basic, select Properties.
Attribute
Description
Desc
Enter the description of the Greex rule.
Id
Enter a unique identifier of the Greex rule.
Name
Enter the name of the Greex rule.
Return Type
Enter the return type of the Greex rule. For a normal Greex rule, the valid values are "Xml", "String", "Boolean", and "PureXML". The normal Greex rule can return an XML document, string, or boolean value.
Type
By default, a Greex rule is a normal Greex rule.
- From the menu bar, select Window > Show View > Other....
- Under the Greex Rule root element, create a new IF ELSE
construct element, as needed. Right-click on the Greex
Rule root element and select New
Child > If/Else from
the pop-up menu. You can create any level of nesting of IF and ELSE constructs.
- Select the If/Else element. In the Properties view, enter the name of the If element in the Name property.
- Under the If/Else element, create a new Condition child element. Right-click on the If/Else element and selectNew Child > Condition from the pop-up menu.
- Select the Condition element. In the Properties view, enter the name of the Condition element in the Name property.
- As every condition must return a value, under the If/Else element, create a new Return element and specify the appropriate return value for the associated condition. Right-click on the If/Else element and select New Child > Return from the pop-up menu.
- Right-click on the Return element and select New Child > Value from the pop-up menu. The Enter the value pop-up window displays.
- Enter the value that you want to return if the IF condition satisfies.
- Select the Return element. In the Properties view, in the Default property, specify the default value (if necessary) that you want to return if the IF condition is not satisfied. In the Output property, specify the value that you want to return if the IF condition satisfies.
- Under the Condition element, create a new Expression element to specify the expressions that you want to evaluate for the condition to satisfy. Right-click on the Condition element and select New Child > Expression from the pop-up menu. The Edit Expression pop-up window displays.
- In Expression, enter the expression you want to evaluate.
You can make function calls in the expression by prefixing the function
name with "fn:". You can also pass functions
to other functions. Note: Press Ctrl+Space and select the expression from the drop-down list.
- (Optional) If you want to evaluate a set of expressions
together, you must group them. Under the Condition element, create
a new Group element to group a set of expressions together. Right-click
on the Condition element and select New Child > Group from the pop-up menu.
Now, you can add more than one expression to this group. Right-click on the Group element and select New Child > Expression from the pop-up menu.
You can also add a new Group element to an existing Group element. Right-click on the Group element and select New Child > Group from the pop-up menu.
Note: You can create any level of nested Group and Expression elements. - (Optional) Select the Group element. In the Properties
view, specify the operation that you want to perform on the set of
expressions in the Op property. The valid values are: "or" and "and".
If you specify the Op property as "or", a condition is satisfied if any of the expressions specified in the group is "true".
If you specify the Op property as "and", a condition is satisfied only if all expressions specified in the group is "true".
- Click Save.