tags:

views:

50

answers:

1

I am trying to write a schema that doesn't require specific ordering for an extended type. I tried to use an "all" group, but it seems to only permit a "sequence".

I am getting this error message and am a bit confused.

An all model group must appear in a particle with {min occurs} = {max occurs} = 1, and that particle must be part of a pair which constitutes the {content type} of a complex type definition.

    <complexType name="credentialElement">
    <complexContent>
        <extension base="env:namedElement">
            <all>
                <element name="username" type="env:envString" minOccurs="1" />
                <element name="password" type="env:envString" minOccurs="1" />
                <element name="domain" type="env:envString" minOccurs="0" />
            </all>
        </extension>
    </complexContent>
</complexType>

Eric

EDIT: It seems that this is not possible. After running this through xmlint I got a different error message:

The type has an 'all' model group in its {content type} and thus cannot be derived from a non-empty type, since this would produce a 'sequence' model group containing the 'all' model group; 'all' model groups are not allowed to appear inside other model groups.

Not sure if there is a clean work around.

A: 

The reason is because children of an <all> element must contain 0 or 1 occurances. You should omit the minOccurs attributes so it defaults to 1. If you need to specify minOccurs then also specify maxOccurs.

Taylor Leese
This doesn't seem to work.
esiegel