Hi,
I am trying to define a Key element for a vehicle schema. I have three ways
to uniquely identify a vehicle such as URN, UnitID and Vin.
I'd like to make a rule that ensures that at least one of the three is
present, but 2 or all 3 can be present. I tried something like below, but it
does not seem valid.
Thanks in advance for any assistance anyone may be able to provide. Portion
of schema is posted below. Hopefully it gives some idea as to what I am
trying to accomplish.
Best regards,
Victor
<xs:complexType name="VehKeyType">
<xs:choice>
<xs:sequence>
<!--Choice 1 URN Type is present-->
<xs:element name="URN" type="URNType">
</xs:element>
<xs:element name="UnitId" type="UnitIdType" minOccurs="0">
</xs:element>
<xs:element name="Vin" type="VinType" minOccurs="0">
</xs:element>
</xs:sequence>
<xs:sequence>
<!--Choice 2 Unit ID is present-->
<xs:element name="URN" type="URNType" minOccurs="0">
</xs:element>
<xs:element name="UnitId" type="UnitIdType">
</xs:element>
<xs:element name="Vin" type="VinType" minOccurs="0">
</xs:element>
</xs:sequence>
<xs:sequence>
<!--Choice 3 Vin is present. -->
<xs:element name="URN" type="URNType" minOccurs="0">
</xs:element>
<xs:element name="UnitId" type="UnitIdType" minOccurs="0">
</xs:element>
<xs:element name="Vin" type="VinType">
</xs:element>
</xs:sequence>
</xs:choice>
</xs:complexType>