Re: Difficult logical relationship in complex type

On 23 Aug 2010, at 10:39 , McBride, David wrote:

> I’m having difficulties defining a logical relationship within a  
> complex type.  The complex type contains 4 sub-elements.  Let’s call  
> them A, B, C, D.  The logical relationship is this:
>
> 1.       One, or more of elements B, C, or D are required.
> 2.       There may be zero or more instances of element A.
> 3.       Element A may never be the only element.  In other words,  
> there may only be an instance of A, if there is also at least one  
> instance of B, C, or D.
>
> If I was just dealing with B, C, and D, I could handle that.   
> However, adding the requirements for A has thrown me.

If one of B, C, and D is required, then your constraint 3 seems
always to be satisfied.  Element A will never be the only element,
since there will always be a B, C, or D.  Or have I misunderstood
the constraints?

If you do not care about the order, then the simplest thing
might be the XSD equivalent of the regular expression

   (A*, (B | C | D)+)

If I've misunderstood the constraints, then this content model
may not do the job -- explaining why not would be a good step
towards clarifying the requirements.

HTH

-- 
****************************************************************
* C. M. Sperberg-McQueen, Black Mesa Technologies LLC
* http://www.blackmesatech.com
* http://cmsmcq.com/mib
* http://balisage.net
****************************************************************

Received on Tuesday, 24 August 2010 13:28:43 UTC