You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by "Hollenbeck, Scott" <sh...@verisign.com> on 2001/11/16 16:32:20 UTC

Sequence of Optional Elements

I'm trying to figure out a way to define a model group that defines a
sequence of optional elements, but requires that at least one of the
elements be present and unique within an instance.  The basic problem is
that a <sequence> like this:

<sequence>
  <Elements 1 through x, all optional>
</sequence>

Would allow an empty sequence.  At some point in the past it's been
suggested on this list that a model group like this would do the trick:

<choice minOccurs="1" maxOccurs="x">
  <Elements 1 through x>
</choice>

This sort of model group ensures that there is at least one and no more than
x elements in an instance, but I've found that it also allows for repeated
occurrences of any single element.  That is, it allows making the same
choice more than once.

Does anyone know of a confirmed method to specify a model group that
contains all optional elements, but requires at least one unique element to
be present?

-Scott- 

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org