Re: minOccurs help?

Hi Neill,

> is minOccurs="0" the same as use="optional" ???
> I am confused between the 2?

use="optional" is used on an attribute reference or declaration to
state that a particular attribute is optional.

minOccurs="0" is used on a particle in a model group, and yes, it
means that the element (or model group - you can use minOccurs on
xs:sequence, xs:choice and so on) is optional.

> If so, does it mean that minOccurs="1" requires at least one entry?

Yes - the particle must occur a minimum of one time.

The reason you have minOccurs/maxOccurs on particles within a content
model is that, unlike attributes, you can have the same element
repeated any number of times in content. With attributes, the only
options are that it either has to be present (use="required") or that
it's optional (use="optional"). On the other hand, it's sometimes
useful to say that an element could occur between 5 and 100 times
(with minOccurs="5" and maxOccurs="100").

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/

Received on Monday, 21 January 2002 06:50:16 UTC