We build a schema file (for custom requirements) for the input parameters for a BPEL process. Out of them, we want to make few parameters as mandatory. In this post you will learn how to achieve this.
Specifying how many times an element can app ear is referred to as cardinality. Cardinality is specified using the attributes minOccurs and maxOccurs, and allows an element to be specified as mandatory, optional, or that it can appear many times. minOccurs can be assigned any non-negative integer value (e.g. 0, 1, 2, 3… etc.), and maxOccurs can be assigned any non-negative integer value or the string constant “unbounded” meaning no maximum.
The default values for minOccurs and maxOccurs is 1. Therefore, if both the minOccurs and maxOccurs attributes are absent, as in all the previous examples, the element must appear once and once only.
If we don’t specify minOccurs or maxOccurs, then the default values of 1 are used, so in this case there has to be one and only one occurrence of Customer_dob. Here by default all the fields in the schema will be manadatory.<xs:element name=”Customer_order“ type=”xs:integer“ minOccurs =”0“ maxOccurs=”unbounded“/>
Here, a customer can have any number of Customer_orders (even 0). So to make any field optional in the schema file, you need to add minOccurs =”0″ in the schema file.<xs:element name=”Customer_hobbies“ type=”xs:string“ minOccurs=”2“ maxOccurs=”10“/>
In this example, the element Customer_hobbies must appear at least twice, but no more than 10 times