This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to choose only one of the three existing elements in XSD

 
vamshidhar nimbagiri
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I have follwing XSD which contains three elements i.e., RID, BID and KID of which only one of
them should present and remaing are optional.
Could any body please tell me how to achieve this

<xs:element name="CustomerCode">
<xs:complexType>
<xs:sequence>
<xs:element name="RID">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="[A-Z0-9]{15}" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="BID">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="[A-Z0-9]{15}" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="KD">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="[A-Z0-9]{15}" />
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>


Thanks in advance

Vamshi
 
vamshidhar nimbagiri
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks guys i got the answer
by using <xs:choice
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic