Designing Your own XML Schema: Learn the Essentials - XML Schema: a simple practical example continued (Page 5 of 6 )
In the previous section, I used only one employee detail in the XML document. Can we have more than one employee provided in the XML document according to the previous schema? The answer is NO. By default, every element can occur only once. We need to make a small modification to the above schema to make it accept a larger number of employee details. The modification could be as follows:
Now you should observe the word “maxOccurs.” By default “maxOccurs” is set to 1. This means you can have only one employee detail provided within the XML document. Now, we specified “maxOccurs” with “unbounded.” This means a countless number of employee details can be provided within the XML document.
Let us check this with a sample XML document conforming to the above schema now.