Scott M. said:
Well, I think that is a pretty fundamental question but consider this XML:
<cars>
<car>
<make>Honda</make>
<model>Accord</model>
<possibleColor>Yellow</possibleColor>
<possibleColor>Green</possibleColor>
<possibleColor>Blue</possibleColor>
<possibleColor>Black</possibleColor>
<possibleColor>White</possibleColor>
<possibleColor>Grey</possibleColor>
</car>
<car>
<make>Dodge</make>
<model>Viper</model>
<possibleColor>Red</possibleColor>
<possibleColor>Green</possibleColor>
<possibleColor>Blue</possibleColor>
<possibleColor>Black</possibleColor>
<turbo>true</turbo>
</car>
</cars>
Now, it certainly doesn't make sense that one particular car would have more
than one model and we need to make sure that each car we talk about tells us
what model it is, so we would need a way to say "Hey, you can only use the
<model> element once and it can't be omitted." That's where the use of
MinOccurs=1 MaxOccurs=1 would come in.
On the other hand, you can order this car in one of several colors but it
must have at least one color that it could be, so we need to be able to have
many <possibleColor> elements. This is where MinOccurs=1 MaxOccurs=6 would
come in.
Now, the Honda Accord is not a turbocharged vehicle, but other a Dodge Viper
"might" be, so in the schema we would have a <tubo> element that is
configured with MinOccurs=0 MaxOccurs=1 to specify that a <turbo> element
"could" exist once but doesn't have to.
Does this make sense?