galaxy quest

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hey all,

in the overall scheme of the planet earth, why does there have to be a
MinOccurs property of an element in the dataset designer?

What is this used for in general lamen's terms.

thanks,
rodchar
 
Because without it, how would you specify that an element should occur
exactly one and only one time?
 
could you please give me an example or two why you would want to specify an
element occur only once or any specific number of times.

please forgive me if i'm not seeing the obvious. i'm relatively new to xml.
 
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?
 
thanks that helped.

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top