views:

41

answers:

1

In the following schema I am trying to make an unordered xml that extends simpleConfigurationObject:

<xs:complexType name="forTestingConfigurationObjectCreator">
  <xs:complexContent>
    <xs:extension base="simpleConfigurationObject">
      <xs:all>
        <xs:element name="a" type="xs:string"/>
        <xs:element name="b" type="xs:string" minOccurs="0"/>
      </xs:all>
    </xs:extension>
  </xs:complexContent>
</xs:complexType>

<xs:complexType name="simpleConfigurationObject">
  <xs:all>
    <xs:element name="base" type="xs:string" minOccurs="0"/>
  </xs:all>
</xs:complexType>

But I get the following error on the xs:all "all is not the only particle in the group, or is being used as an extension" (which is correct)

Off-course if put the base element inside the xs:all and not use xs:extension at all I will get an unordered schema restriction. (but that is not what I want)

The question is: how can I produce unordered schema with the extension?

Thanks

+1  A: 

You can't, this is prohibited by the schema specification. See this post of Henry Thompson (the author of the spec) for an explanation.

In short: the content model of the base type has to be completely parsed by the time the parser gets to the derived type; that is not possible with what you are trying to achieve.

xcut