1

I it possible to make a choice scenario, like (A or B or Both). If yes, how can this be done with the following elements?

<xs:element name="a" type="typeA"  />
<xs:element name="b" type="typeB" />

Hope you can help.

Regards, Nima

Nima
  • 937
  • 1
  • 13
  • 20

1 Answers1

3

You can see XSD "one or both" choice construct leads to ambiguous content model

<xs:schema xmlns:xs="...">
  <xs:element name="a" type="typeA"  />
  <xs:element name="b" type="typeB" />
  <xs:element name="...">
    <xs:complexType>
      <xs:sequence>
        <xs:choice>
          <xs:sequence>
            <xs:element ref="a"/>
            <xs:element ref="b" minOccurs="0"/>
          </xs:sequence>
          <xs:element ref="b"/>
        </xs:choice>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>
Community
  • 1
  • 1
Luca
  • 4,223
  • 1
  • 21
  • 24