Ok - I see what you mean. I misread your regex.
BTW - the regex I suggested is nothing unusual, it's simply a common perl extended regular expression.
The only remaining problem with the XSD form is that it implies order, but I may have to live with that.
Thanks again for your response.
-----Original Message-----
From: C. M. Sperberg-McQueen [mailto:cmsmcq@blackmesatech.com]
Sent: Tuesday, August 24, 2010 10:41 AM
To: McBride, David
Cc: C. M. Sperberg-McQueen; xmlschema-dev@w3.org
Subject: Re: Difficult logical relationship in complex type
On 24 Aug 2010, at 11:08 , McBride, David wrote:
> Thanks for your response.
>
> Order does not matter.
>
> I think you've misunderstood the constraints (or I haven't expressed
> them clearly). Specifically, I'm trying to prohibit the case where
> element 'A' is the only content. The rexex you proposed would allow
> this case to occur.
How? The content model (A*, (B|C|D)+) allows zero or more A
elements, followed by one or more B, C, or D elements.
An A element by itself matches the initial token, but
then leaves nothing but the empty string to match
the sub-expression (B|C|D)+. But the empty string does
not match that construct: at least one of B, C, or D
is required. (It's a plus sign, meaning one-or-more, not
a star meaning zero-or-more.)
>
> I think the regex would be more like the following:
>
> (?([BCD]+)A*)
>
> i.e.,
>
> IF one or more instanced of B, C, or D,
> THEN zero or more instances of A
Perhaps we are simply using different notations for regular
expressions: the expression you write is not legal in
any syntax I know, because the '?' operator does not follow
any regular expression. (If it matters, the syntax I'm
using is that of DTDs.)
To put the content model into XSD form, you might write
either:
<sequence>
<element ref="A" minOccurs="0" maxOccurs="unbounded"/>
<choice minOccurs="1" maxOccurs="unbounded">
<element ref="B"/>
<element ref="C"/>
<element ref="D"/>
</choice>
</sequence>
(which puts the As first), or
<sequence>
<choice minOccurs="1" maxOccurs="unbounded">
<element ref="B"/>
<element ref="C"/>
<element ref="D"/>
</choice>
<element ref="A" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
(which puts them last). Does that help?
--
****************************************************************
* C. M. Sperberg-McQueen, Black Mesa Technologies LLC
* http://www.blackmesatech.com
* http://cmsmcq.com/mib
* http://balisage.net
****************************************************************