Re: Empty choice in a group ?

"Bruno Chatel" <bcha@chadocs.net> writes:

> Is the following  allowed :
>
> <xs:group name="empty.Grp">
>   <xs:choice/>
>  </xs:group>

Yes.

> But msxml detect an error :

> empty.xsd#/schema[1]/group[position() = 1 and @name =
> 'empty.Grp']/choice[1] Empty can be satisfied only if {minOccurs =
> 0}.
>
> What is the correct answer ? 

MSXML's comment is correct -- such a group can never be satisfied.

*But* it's not an error in the schema (document) to have such an
unsatisfiable group, so _if_ MSXML is refusing to use it, _that's_ a
bug.

If on the other hand it's offering that comment when you try to
validate an element whose type definition consists of that group, then
that's just a helpful comment as to why your instance is being
rejected, and there is no bug.

The analogy I usually offer is with boolean algebra -- AND with no
arguments is true, but OR with no arguments is false.

ht
-- 
 Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
                     Half-time member of W3C Team
    2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
            Fax: (44) 131 650-4587, e-mail: ht@inf.ed.ac.uk
                   URL: http://www.ltg.ed.ac.uk/~ht/
[mail really from me _always_ has this .sig -- mail without it is forged spam]

Received on Friday, 7 January 2005 17:48:08 UTC